forked from me-no-dev/ESPAsyncWebServer
use uint8_t to store WebRequestMethod (#68)
so we can have server.on("/foo", HTTP_GET | HTTP_POST,
[](AsyncWebServerRequest *request) {}) to handle multiple methods.
this also saves a bit memory, enums are stored in int, which is 32bit on
xtensa. since we only have 7 methods (plus HTTP_ANY for everything) we
only want 7 bit, so uint8_t is pretty sufficient.
This commit is contained in:
@@ -854,12 +854,12 @@ String AsyncWebServerRequest::urlDecode(const String& text){
|
||||
|
||||
const char * AsyncWebServerRequest::methodToString(){
|
||||
if(_method == HTTP_ANY) return "ANY";
|
||||
else if(_method == HTTP_GET) return "GET";
|
||||
else if(_method == HTTP_POST) return "POST";
|
||||
else if(_method == HTTP_DELETE) return "DELETE";
|
||||
else if(_method == HTTP_PUT) return "PUT";
|
||||
else if(_method == HTTP_PATCH) return "PATCH";
|
||||
else if(_method == HTTP_HEAD) return "HEAD";
|
||||
else if(_method == HTTP_OPTIONS) return "OPTIONS";
|
||||
else if(_method & HTTP_GET) return "GET";
|
||||
else if(_method & HTTP_POST) return "POST";
|
||||
else if(_method & HTTP_DELETE) return "DELETE";
|
||||
else if(_method & HTTP_PUT) return "PUT";
|
||||
else if(_method & HTTP_PATCH) return "PATCH";
|
||||
else if(_method & HTTP_HEAD) return "HEAD";
|
||||
else if(_method & HTTP_OPTIONS) return "OPTIONS";
|
||||
return "UNKNOWN";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user