Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of HTTPClient by
Revision 19:9954a6e0ef05, committed 2017-03-27
- Comitter:
- Jonathan Santerre
- Date:
- Mon Mar 27 16:19:24 2017 -0400
- Parent:
- 18:277279a1891e
- Commit message:
- Adapt lib to work with plantus api
Changed in this revision
--- a/HTTPClient.cpp Wed May 07 16:48:10 2014 +0000 +++ b/HTTPClient.cpp Mon Mar 27 16:19:24 2017 -0400 @@ -46,8 +46,8 @@ #include "HTTPClient.h" -HTTPClient::HTTPClient() : -m_sock(), m_basicAuthUser(NULL), m_basicAuthPassword(NULL), m_httpResponseCode(0) +HTTPClient::HTTPClient(const char* identifier) : +m_sock(), m_basicAuthUser(NULL), m_basicAuthPassword(NULL), m_httpResponseCode(0), identifier(identifier) { } @@ -173,6 +173,12 @@ //Send default headers DBG("Sending headers"); + + DBG("X-Authorization: %s\r\n", identifier); + snprintf(buf, sizeof(buf), "X-Authorization: %s\r\n", identifier); + ret = send(buf); + CHECK_CONN_ERR(ret); + if( pDataOut != NULL ) { if( pDataOut->getIsChunked() )
--- a/HTTPClient.h Wed May 07 16:48:10 2014 +0000 +++ b/HTTPClient.h Mon Mar 27 16:19:24 2017 -0400 @@ -58,7 +58,7 @@ { public: ///Instantiate the HTTP client - HTTPClient(); + HTTPClient(const char*); ~HTTPClient(); #if 0 //TODO add header handlers @@ -149,6 +149,7 @@ const char* m_basicAuthUser; const char* m_basicAuthPassword; int m_httpResponseCode; + const char* identifier; };
--- a/data/HTTPText.cpp Wed May 07 16:48:10 2014 +0000 +++ b/data/HTTPText.cpp Mon Mar 27 16:19:24 2017 -0400 @@ -55,7 +55,7 @@ /*virtual*/ int HTTPText::getDataType(char* type, size_t maxTypeLen) //Internet media type for Content-Type header { - strncpy(type, "text/plain", maxTypeLen-1); + strncpy(type, "application/json", maxTypeLen-1); type[maxTypeLen-1] = '\0'; return OK; }