File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -47,6 +47,14 @@ void HTTPResponse::setStatusText(std::string statusText) {
4747 _statusText = statusText;
4848}
4949
50+ uint16_t HTTPResponse::getStatusCode () {
51+ return _statusCode;
52+ }
53+
54+ std::string HTTPResponse::getStatusText () {
55+ return _statusText;
56+ }
57+
5058void HTTPResponse::setHeader (std::string name, std::string value) {
5159 _headers.set (new HTTPHeader (name, value));
5260}
@@ -102,7 +110,7 @@ void HTTPResponse::printHeader() {
102110
103111 // Status line, like: "HTTP/1.1 200 OK\r\n"
104112 // intToString(_statusCode)
105- std::string statusLine = " HTTP/1.1 200 " + _statusText + " \r\n " ;
113+ std::string statusLine = " HTTP/1.1 " + intToString (_statusCode) + " " + _statusText + " \r\n " ;
106114 printInternal (statusLine, true );
107115
108116 // Each header, like: "Host: myEsp32\r\n"
Original file line number Diff line number Diff line change @@ -33,6 +33,8 @@ class HTTPResponse : public Print {
3333
3434 void setStatusCode (uint16_t statusCode);
3535 void setStatusText (std::string statusText);
36+ uint16_t getStatusCode ();
37+ std::string getStatusText ();
3638 void setHeader (std::string name, std::string value);
3739 bool isHeaderWritten ();
3840
You can’t perform that action at this time.
0 commit comments