Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libraries/WebServer/src/WebServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void WebServer::sendContent_P(PGM_P content, size_t size) {
}


void WebServer::_streamFileCore(const size_t fileSize, const String & fileName, const String & contentType)
void WebServer::_streamFileCore(const size_t fileSize, const String & fileName, const String & contentType, const int code)
{
using namespace mime;
setContentLength(fileSize);
Expand All @@ -536,7 +536,7 @@ void WebServer::_streamFileCore(const size_t fileSize, const String & fileName,
contentType != String(FPSTR(mimeTable[none].mimeType))) {
sendHeader(F("Content-Encoding"), F("gzip"));
}
send(200, contentType, "");
send(code, contentType, "");
}

String WebServer::pathArg(unsigned int i) {
Expand Down
6 changes: 3 additions & 3 deletions libraries/WebServer/src/WebServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ class WebServer
static String urlDecode(const String& text);

template<typename T>
size_t streamFile(T &file, const String& contentType) {
_streamFileCore(file.size(), file.name(), contentType);
size_t streamFile(T &file, const String& contentType, const int code = 200) {
_streamFileCore(file.size(), file.name(), contentType, code);
return _currentClient.write(file);
}

Expand All @@ -160,7 +160,7 @@ class WebServer
void _prepareHeader(String& response, int code, const char* content_type, size_t contentLength);
bool _collectHeader(const char* headerName, const char* headerValue);

void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType);
void _streamFileCore(const size_t fileSize, const String & fileName, const String & contentType, const int code = 200);

String _getRandomHexString();
// for extracting Auth parameters
Expand Down