1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-13 13:01:55 +03:00

Add HTTP_HEAD to HTTPMethod and parse it (#6413)

* Add HTTP_HEAD to HTTPMethod

* Parse the HTTP_HEAD variant of HTTPMethod from a method string

* Add HTTP_HEAD to the ESP8266WebServer constants

* Skip sending the content of the response if the HTTP method is HEAD method

* Convert the HTTP status code 418  to string
This status code is an easter egg from the IETF and is described in 
[RFC2324](https://tools.ietf.org/html/rfc2324#section-2.3.2)
This commit is contained in:
Zakary Kamal Ismail
2019-08-17 14:58:40 -04:00
committed by Earle F. Philhower, III
parent 8f45a0fb91
commit 0dbb04e881
4 changed files with 9 additions and 4 deletions

View File

@ -480,6 +480,7 @@ void ESP8266WebServerTemplate<ServerType>::send(int code, const String& content_
template <typename ServerType>
void ESP8266WebServerTemplate<ServerType>::sendContent(const String& content) {
if (_currentMethod == HTTP_HEAD) return;
const char * footer = "\r\n";
size_t len = content.length();
if(_chunked) {
@ -728,6 +729,7 @@ const String ESP8266WebServerTemplate<ServerType>::responseCodeToString(const in
case 415: return F("Unsupported Media Type");
case 416: return F("Requested range not satisfiable");
case 417: return F("Expectation Failed");
case 418: return F("I'm a teapot");
case 500: return F("Internal Server Error");
case 501: return F("Not Implemented");
case 502: return F("Bad Gateway");