Fork of OAuth4Tw to use mbed's official EthernetInterface and HTTPClient
Fork of OAuth4Tw by
Diff: oauth_http.cpp
- Revision:
- 1:b3501683b856
- Parent:
- 0:0048b264a3ad
--- a/oauth_http.cpp Mon Dec 12 18:47:10 2011 +0000 +++ b/oauth_http.cpp Thu Apr 30 10:19:31 2015 +0000 @@ -34,6 +34,10 @@ #include "oauth.h" #include <HTTPClient.h> +#include "oauth_data.h" + +#define RESULT_BUFFER_SIZ 1024 +static char result_buffer[RESULT_BUFFER_SIZ]; /* wrapper functions */ @@ -52,10 +56,10 @@ std::string oauth_http_post(const char *u, const char *p) { HTTPClient http; - HTTPText req("application/x-www-form-urlencoded"); - HTTPText res; - req.set(p); + OAuthDataOut req("application/x-www-form-urlencoded", p); + OAuthDataIn res(result_buffer, RESULT_BUFFER_SIZ); + http.post(u, req, &res); - return res.get(); + return res.getData(); }