diff --git a/src/protocols/HTTP/HTTP.cpp b/src/protocols/HTTP/HTTP.cpp index 6f4cd23d..63b2fe95 100644 --- a/src/protocols/HTTP/HTTP.cpp +++ b/src/protocols/HTTP/HTTP.cpp @@ -142,7 +142,7 @@ int16_t HTTPClient::post(const char* url, const char* content, String& response, // build the POST request char contentLengthStr[12]; - sprintf(contentLengthStr, "%d", strlen(content)); + sprintf(contentLengthStr, "%u", (uint16_t)strlen(content)); char* request = new char[strlen(endpoint) + strlen(host) + strlen(contentType) + strlen(contentLengthStr) + strlen(content) + 64 + 1]; strcpy(request, "POST "); strcat(request, endpoint); diff --git a/src/protocols/HTTP/HTTP.h b/src/protocols/HTTP/HTTP.h index edc7d6f1..ae9a3888 100644 --- a/src/protocols/HTTP/HTTP.h +++ b/src/protocols/HTTP/HTTP.h @@ -19,7 +19,7 @@ class HTTPClient { \param port Port to be used for HTTP. Defaults to 80. */ - HTTPClient(TransportLayer* tl, uint16_t port = 80); + explicit HTTPClient(TransportLayer* tl, uint16_t port = 80); /*! \brief Sends HTTP GET request.