1
0
mirror of https://github.com/arduino-libraries/ArduinoHttpClient.git synced 2025-04-19 21:22:15 +03:00

Add support for String parameters to sendHeader and sendHeader

This commit is contained in:
Sandeep Mistry 2016-06-17 12:55:17 -04:00
parent 9ab55ef6e2
commit 33804d4534

View File

@ -105,6 +105,9 @@ public:
*/ */
void sendHeader(const char* aHeader); void sendHeader(const char* aHeader);
void sendHeader(const String& aHeader)
{ sendHeader(aHeader.c_str()); }
/** Send an additional header line. This is an alternate form of /** Send an additional header line. This is an alternate form of
sendHeader() which takes the header name and content as separate strings. sendHeader() which takes the header name and content as separate strings.
The call will add the ": " to separate the header, so for example, to The call will add the ": " to separate the header, so for example, to
@ -114,6 +117,9 @@ public:
*/ */
void sendHeader(const char* aHeaderName, const char* aHeaderValue); void sendHeader(const char* aHeaderName, const char* aHeaderValue);
void sendHeader(const String& aHeaderName, const String& aHeaderValue)
{ sendHeader(aHeaderName.c_str(), aHeaderValue.c_str()); }
/** Send an additional header line. This is an alternate form of /** Send an additional header line. This is an alternate form of
sendHeader() which takes the header name and content separately but where sendHeader() which takes the header name and content separately but where
the value is provided as an integer. the value is provided as an integer.
@ -124,6 +130,9 @@ public:
*/ */
void sendHeader(const char* aHeaderName, const int aHeaderValue); void sendHeader(const char* aHeaderName, const int aHeaderValue);
void sendHeader(const String& aHeaderName, const int aHeaderValue)
{ sendHeader(aHeaderName.c_str(), aHeaderValue); }
/** Send a basic authentication header. This will encode the given username /** Send a basic authentication header. This will encode the given username
and password, and send them in suitable header line for doing Basic and password, and send them in suitable header line for doing Basic
Authentication. Authentication.
@ -132,6 +141,9 @@ public:
*/ */
void sendBasicAuth(const char* aUser, const char* aPassword); void sendBasicAuth(const char* aUser, const char* aPassword);
void sendBasicAuth(const String& aUser, const String& aPassword)
{ sendBasicAuth(aUser.c_str(), aPassword.c_str()); }
/** Finish sending the HTTP request. This basically just sends the blank /** Finish sending the HTTP request. This basically just sends the blank
line to signify the end of the request line to signify the end of the request
*/ */