Library for Firebase, PUT, PATCH, POST, GET, DELETE operations supported, (others are available, todo). Based on Mbed's https-example. Tested on STM32F767 using ETHERNET and ESP8266 WIFI interfaces and STM32F446 using ESP8266 WIFI interface.
Diff: source/https_request.h
- Revision:
- 1:4f2c1fcc6fb6
- Parent:
- 0:768ae9838086
--- a/source/https_request.h Thu Jan 23 22:18:11 2020 +0000 +++ b/source/https_request.h Sun Mar 08 14:43:48 2020 +0000 @@ -72,7 +72,7 @@ * @param[in] body_callback Callback on which to retrieve chunks of the response body. If not set, the complete body will be allocated on the HttpResponse object, which might use lots of memory. - */ + */ HttpsRequest(TLSSocket* socket, http_method method, const char* url, @@ -83,16 +83,20 @@ _body_callback = body_callback; _request_builder = new HttpRequestBuilder(method, _parsed_url); _response = NULL; - _we_created_socket = false; } - virtual ~HttpsRequest() {} protected: - virtual nsapi_error_t connect_socket(char *host, uint16_t port) { - return ((TLSSocket*)_socket)->connect(host, port); - } + + virtual nsapi_error_t connect_socket(char *host, uint16_t port) { + ((TLSSocket*)_socket)->set_hostname(host); + SocketAddress addr; + addr.set_port(port); + return ((TLSSocket*)_socket)->connect(addr); + } + + }; #endif // _MBED_HTTPS_REQUEST_H_