Skip to content

Commit 33804d4

Browse files
committed
Add support for String parameters to sendHeader and sendHeader
1 parent 9ab55ef commit 33804d4

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

HttpClient.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,9 @@ class HttpClient : public Client
105105
*/
106106
void sendHeader(const char* aHeader);
107107

108+
void sendHeader(const String& aHeader)
109+
{ sendHeader(aHeader.c_str()); }
110+
108111
/** Send an additional header line. This is an alternate form of
109112
sendHeader() which takes the header name and content as separate strings.
110113
The call will add the ": " to separate the header, so for example, to
@@ -114,6 +117,9 @@ class HttpClient : public Client
114117
*/
115118
void sendHeader(const char* aHeaderName, const char* aHeaderValue);
116119

120+
void sendHeader(const String& aHeaderName, const String& aHeaderValue)
121+
{ sendHeader(aHeaderName.c_str(), aHeaderValue.c_str()); }
122+
117123
/** Send an additional header line. This is an alternate form of
118124
sendHeader() which takes the header name and content separately but where
119125
the value is provided as an integer.
@@ -124,6 +130,9 @@ class HttpClient : public Client
124130
*/
125131
void sendHeader(const char* aHeaderName, const int aHeaderValue);
126132

133+
void sendHeader(const String& aHeaderName, const int aHeaderValue)
134+
{ sendHeader(aHeaderName.c_str(), aHeaderValue); }
135+
127136
/** Send a basic authentication header. This will encode the given username
128137
and password, and send them in suitable header line for doing Basic
129138
Authentication.
@@ -132,6 +141,9 @@ class HttpClient : public Client
132141
*/
133142
void sendBasicAuth(const char* aUser, const char* aPassword);
134143

144+
void sendBasicAuth(const String& aUser, const String& aPassword)
145+
{ sendBasicAuth(aUser.c_str(), aPassword.c_str()); }
146+
135147
/** Finish sending the HTTP request. This basically just sends the blank
136148
line to signify the end of the request
137149
*/

0 commit comments

Comments
 (0)