diff options
Diffstat (limited to 'minion/src/wifi_module.cpp')
-rw-r--r-- | minion/src/wifi_module.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/minion/src/wifi_module.cpp b/minion/src/wifi_module.cpp index 7c3e5bc..2f4e57c 100644 --- a/minion/src/wifi_module.cpp +++ b/minion/src/wifi_module.cpp @@ -329,11 +329,16 @@ auto WiFiModule::close_connection(size_t connection_id) noexcept -> bool return true; } -auto WiFiModule::send_response(size_t connection_id, const char *data) noexcept -> bool +auto WiFiModule::send_response( + size_t connection_id, + size_t status_code, + const char *data +) noexcept -> bool { const auto *cmd = "AT+CIPSEND"; - const auto data_length = strlen(data); + const auto data_length = strlen(RESPONSE_HTTP_VERSION) + 1 + + RESPONSE_STATUS_CODE_LENGTH + 4 + strlen(data); auto command_length = strlen(cmd) + 50U + data_length + 1U; @@ -355,6 +360,10 @@ auto WiFiModule::send_response(size_t connection_id, const char *data) noexcept _read(TIMEOUT_MEDIUM, response); + _serial.print(RESPONSE_HTTP_VERSION); + _serial.print(" "); + _serial.print(status_code); + _serial.print("\r\n\r\n"); _serial.print(data); strcpy(response, ""); |