diff --git a/src/HttpClient.cpp b/src/HttpClient.cpp index 1c73464..973d172 100644 --- a/src/HttpClient.cpp +++ b/src/HttpClient.cpp @@ -63,6 +63,16 @@ void HttpClient::beginRequest() iState = eRequestStarted; } +void HttpClient::sendApiKeyHeader(const char* apiKey) { + if (iState < eRequestSent) { + finishHeaders(); + } + + String header = "apikey: "; + header += apiKey; + sendHeader(header); +} + int HttpClient::startRequest(const char* aURLPath, const char* aHttpMethod, const char* aContentType, int aContentLength, const byte aBody[]) { diff --git a/src/HttpClient.h b/src/HttpClient.h index 6a7aa1d..3fbd18f 100644 --- a/src/HttpClient.h +++ b/src/HttpClient.h @@ -211,6 +211,8 @@ class HttpClient : public Client void sendBasicAuth(const String& aUser, const String& aPassword) { sendBasicAuth(aUser.c_str(), aPassword.c_str()); } + void sendApiKeyHeader(const char* apiKey); + /** Get the HTTP status code contained in the response. For example, 200 for successful request, 404 for file not found, etc. */