mirror of
https://github.com/arduino-libraries/ArduinoHttpClient.git
synced 2025-04-19 21:22:15 +03:00
Add support for String parameter types for host and URL path
This commit is contained in:
parent
0030d41287
commit
3beefd981a
@ -15,6 +15,11 @@ HttpClient::HttpClient(Client& aClient, const char* aServerName, uint16_t aServe
|
|||||||
resetState();
|
resetState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HttpClient::HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort)
|
||||||
|
: HttpClient(aClient, aServerName.c_str(), aServerPort)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
HttpClient::HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort)
|
HttpClient::HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort)
|
||||||
: iClient(&aClient), iServerName(NULL), iServerAddress(aServerAddress), iServerPort(aServerPort)
|
: iClient(&aClient), iServerName(NULL), iServerAddress(aServerAddress), iServerPort(aServerPort)
|
||||||
{
|
{
|
||||||
|
10
HttpClient.h
10
HttpClient.h
@ -45,6 +45,7 @@ public:
|
|||||||
// FIXME Update tempToPachube example to calculate Content-Length correctly
|
// FIXME Update tempToPachube example to calculate Content-Length correctly
|
||||||
|
|
||||||
HttpClient(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);
|
HttpClient(Client& aClient, const char* aServerName, uint16_t aServerPort = kHttpPort);
|
||||||
|
HttpClient(Client& aClient, const String& aServerName, uint16_t aServerPort = kHttpPort);
|
||||||
HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
|
HttpClient(Client& aClient, const IPAddress& aServerAddress, uint16_t aServerPort = kHttpPort);
|
||||||
|
|
||||||
/** Start a more complex request.
|
/** Start a more complex request.
|
||||||
@ -66,6 +67,9 @@ public:
|
|||||||
int get(const char* aURLPath)
|
int get(const char* aURLPath)
|
||||||
{ return startRequest(aURLPath, HTTP_METHOD_GET); }
|
{ return startRequest(aURLPath, HTTP_METHOD_GET); }
|
||||||
|
|
||||||
|
int get(const String& aURLPath)
|
||||||
|
{ return get(aURLPath.c_str()); }
|
||||||
|
|
||||||
/** Connect to the server and start to send a POST request.
|
/** Connect to the server and start to send a POST request.
|
||||||
@param aURLPath Url to request
|
@param aURLPath Url to request
|
||||||
@return 0 if successful, else error
|
@return 0 if successful, else error
|
||||||
@ -73,6 +77,9 @@ public:
|
|||||||
int post(const char* aURLPath)
|
int post(const char* aURLPath)
|
||||||
{ return startRequest(aURLPath, HTTP_METHOD_POST); }
|
{ return startRequest(aURLPath, HTTP_METHOD_POST); }
|
||||||
|
|
||||||
|
int post(const String& aURLPath)
|
||||||
|
{ return post(aURLPath.c_str()); }
|
||||||
|
|
||||||
/** Connect to the server and start to send a PUT request.
|
/** Connect to the server and start to send a PUT request.
|
||||||
@param aURLPath Url to request
|
@param aURLPath Url to request
|
||||||
@return 0 if successful, else error
|
@return 0 if successful, else error
|
||||||
@ -80,6 +87,9 @@ public:
|
|||||||
int put(const char* aURLPath)
|
int put(const char* aURLPath)
|
||||||
{ return startRequest(aURLPath, HTTP_METHOD_PUT); }
|
{ return startRequest(aURLPath, HTTP_METHOD_PUT); }
|
||||||
|
|
||||||
|
int put(const String& aURLPath)
|
||||||
|
{ return put(aURLPath.c_str()); }
|
||||||
|
|
||||||
/** Connect to the server and start to send the request.
|
/** Connect to the server and start to send the request.
|
||||||
@param aURLPath Url to request
|
@param aURLPath Url to request
|
||||||
@param aHttpMethod Type of HTTP request to make, e.g. "GET", "POST", etc.
|
@param aHttpMethod Type of HTTP request to make, e.g. "GET", "POST", etc.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user