mirror of
https://github.com/me-no-dev/ESPAsyncWebServer.git
synced 2025-08-08 07:04:33 +02:00
Using emptyString constant instead of String()
This commit is contained in:
@@ -293,11 +293,11 @@ class AsyncWebServerRequest {
|
|||||||
void redirect(const String& url) { return redirect(url.c_str()); };
|
void redirect(const String& url) { return redirect(url.c_str()); };
|
||||||
|
|
||||||
void send(AsyncWebServerResponse* response);
|
void send(AsyncWebServerResponse* response);
|
||||||
void send(int code, const String& contentType = String(), const String& content = String());
|
void send(int code, const String& contentType = emptyString, const String& content = emptyString);
|
||||||
void send(int code, const String& contentType, const uint8_t* content, size_t len, AwsTemplateProcessor callback = nullptr);
|
void send(int code, const String& contentType, const uint8_t* content, size_t len, AwsTemplateProcessor callback = nullptr);
|
||||||
void send(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback = nullptr);
|
void send(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback = nullptr);
|
||||||
void send(FS& fs, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
void send(FS& fs, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
void send(File content, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
void send(File content, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
void send(Stream& stream, const String& contentType, size_t len, AwsTemplateProcessor callback = nullptr);
|
void send(Stream& stream, const String& contentType, size_t len, AwsTemplateProcessor callback = nullptr);
|
||||||
void send(const String& contentType, size_t len, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
void send(const String& contentType, size_t len, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
||||||
void sendChunked(const String& contentType, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
void sendChunked(const String& contentType, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
||||||
@@ -311,11 +311,11 @@ class AsyncWebServerRequest {
|
|||||||
send(code, contentType, content, callback);
|
send(code, contentType, content, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
AsyncWebServerResponse* beginResponse(int code, const String& contentType = String(), const String& content = String());
|
AsyncWebServerResponse* beginResponse(int code, const String& contentType = emptyString, const String& content = emptyString);
|
||||||
AsyncWebServerResponse* beginResponse(int code, const String& contentType, const uint8_t* content, size_t len, AwsTemplateProcessor callback = nullptr);
|
AsyncWebServerResponse* beginResponse(int code, const String& contentType, const uint8_t* content, size_t len, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncWebServerResponse* beginResponse(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback = nullptr);
|
AsyncWebServerResponse* beginResponse(int code, const String& contentType, PGM_P content, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncWebServerResponse* beginResponse(FS& fs, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
AsyncWebServerResponse* beginResponse(FS& fs, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncWebServerResponse* beginResponse(File content, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
AsyncWebServerResponse* beginResponse(File content, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncWebServerResponse* beginResponse(Stream& stream, const String& contentType, size_t len, AwsTemplateProcessor callback = nullptr);
|
AsyncWebServerResponse* beginResponse(Stream& stream, const String& contentType, size_t len, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncWebServerResponse* beginResponse(const String& contentType, size_t len, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
AsyncWebServerResponse* beginResponse(const String& contentType, size_t len, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
||||||
AsyncWebServerResponse* beginChunkedResponse(const String& contentType, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
AsyncWebServerResponse* beginChunkedResponse(const String& contentType, AwsResponseFiller callback, AwsTemplateProcessor templateCallback = nullptr);
|
||||||
|
@@ -274,7 +274,7 @@ bool AsyncWebServerRequest::_parseReqHead() {
|
|||||||
if (!_temp.startsWith(T_HTTP_1_0))
|
if (!_temp.startsWith(T_HTTP_1_0))
|
||||||
_version = 1;
|
_version = 1;
|
||||||
|
|
||||||
_temp = String();
|
_temp = emptyString;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,7 +327,7 @@ bool AsyncWebServerRequest::_parseReqHeader() {
|
|||||||
_temp.clear();
|
_temp.clear();
|
||||||
#else
|
#else
|
||||||
// Ancient PRI core does not have String::clear() method 8-()
|
// Ancient PRI core does not have String::clear() method 8-()
|
||||||
_temp = String();
|
_temp = emptyString;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -348,7 +348,7 @@ void AsyncWebServerRequest::_parsePlainPostChar(uint8_t data) {
|
|||||||
_temp.clear();
|
_temp.clear();
|
||||||
#else
|
#else
|
||||||
// Ancient PRI core does not have String::clear() method 8-()
|
// Ancient PRI core does not have String::clear() method 8-()
|
||||||
_temp = String();
|
_temp = emptyString;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -390,10 +390,10 @@ void AsyncWebServerRequest::_parseMultipartPostByte(uint8_t data, bool last) {
|
|||||||
|
|
||||||
if (!_parsedLength) {
|
if (!_parsedLength) {
|
||||||
_multiParseState = EXPECT_BOUNDARY;
|
_multiParseState = EXPECT_BOUNDARY;
|
||||||
_temp = String();
|
_temp = emptyString;
|
||||||
_itemName = String();
|
_itemName = emptyString;
|
||||||
_itemFilename = String();
|
_itemFilename = emptyString;
|
||||||
_itemType = String();
|
_itemType = emptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_multiParseState == WAIT_FOR_RETURN1) {
|
if (_multiParseState == WAIT_FOR_RETURN1) {
|
||||||
@@ -450,13 +450,13 @@ void AsyncWebServerRequest::_parseMultipartPostByte(uint8_t data, bool last) {
|
|||||||
_itemIsFile = true;
|
_itemIsFile = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_temp = String();
|
_temp = emptyString;
|
||||||
} else {
|
} else {
|
||||||
_multiParseState = WAIT_FOR_RETURN1;
|
_multiParseState = WAIT_FOR_RETURN1;
|
||||||
// value starts from here
|
// value starts from here
|
||||||
_itemSize = 0;
|
_itemSize = 0;
|
||||||
_itemStartIndex = _parsedLength;
|
_itemStartIndex = _parsedLength;
|
||||||
_itemValue = String();
|
_itemValue = emptyString;
|
||||||
if (_itemIsFile) {
|
if (_itemIsFile) {
|
||||||
if (_itemBuffer)
|
if (_itemBuffer)
|
||||||
free(_itemBuffer);
|
free(_itemBuffer);
|
||||||
|
@@ -36,7 +36,7 @@ class AsyncBasicResponse : public AsyncWebServerResponse {
|
|||||||
String _content;
|
String _content;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AsyncBasicResponse(int code, const String& contentType = String(), const String& content = String());
|
AsyncBasicResponse(int code, const String& contentType = emptyString, const String& content = emptyString);
|
||||||
void _respond(AsyncWebServerRequest* request);
|
void _respond(AsyncWebServerRequest* request);
|
||||||
size_t _ack(AsyncWebServerRequest* request, size_t len, uint32_t time);
|
size_t _ack(AsyncWebServerRequest* request, size_t len, uint32_t time);
|
||||||
bool _sourceValid() const { return true; }
|
bool _sourceValid() const { return true; }
|
||||||
@@ -79,8 +79,8 @@ class AsyncFileResponse : public AsyncAbstractResponse {
|
|||||||
void _setContentType(const String& path);
|
void _setContentType(const String& path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
AsyncFileResponse(FS& fs, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
AsyncFileResponse(FS& fs, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
AsyncFileResponse(File content, const String& path, const String& contentType = String(), bool download = false, AwsTemplateProcessor callback = nullptr);
|
AsyncFileResponse(File content, const String& path, const String& contentType = emptyString, bool download = false, AwsTemplateProcessor callback = nullptr);
|
||||||
~AsyncFileResponse();
|
~AsyncFileResponse();
|
||||||
bool _sourceValid() const { return !!(_content); }
|
bool _sourceValid() const { return !!(_content); }
|
||||||
virtual size_t _fillBuffer(uint8_t* buf, size_t maxLen) override;
|
virtual size_t _fillBuffer(uint8_t* buf, size_t maxLen) override;
|
||||||
|
@@ -353,7 +353,7 @@ size_t AsyncBasicResponse::_ack(AsyncWebServerRequest* request, size_t len, uint
|
|||||||
// we can fit in this packet
|
// we can fit in this packet
|
||||||
if (space > available) {
|
if (space > available) {
|
||||||
_writtenLength += request->client()->write(_content.c_str(), available);
|
_writtenLength += request->client()->write(_content.c_str(), available);
|
||||||
_content = String();
|
_content = emptyString;
|
||||||
_state = RESPONSE_WAIT_ACK;
|
_state = RESPONSE_WAIT_ACK;
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
@@ -465,7 +465,7 @@ size_t AsyncAbstractResponse::_ack(AsyncWebServerRequest* request, size_t len, u
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (headLen) {
|
if (headLen) {
|
||||||
_head = String();
|
_head = emptyString;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (outLen) {
|
if (outLen) {
|
||||||
|
Reference in New Issue
Block a user