|
|
@@ -41,13 +41,13 @@ typedef std::shared_ptr<HttpResponse> Response;
|
|
|
static http_headers DefaultHeaders;
|
|
|
static http_body NoBody;
|
|
|
|
|
|
-Response request(Request req) {
|
|
|
+static inline Response request(Request req) {
|
|
|
Response resp(new HttpResponse);
|
|
|
int ret = http_client_send(req.get(), resp.get());
|
|
|
return ret ? NULL : resp;
|
|
|
}
|
|
|
|
|
|
-Response request(http_method method, const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response request(http_method method, const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
Request req(new HttpRequest);
|
|
|
req->method = method;
|
|
|
req->url = url;
|
|
|
@@ -60,32 +60,32 @@ Response request(http_method method, const char* url, const http_body& body = No
|
|
|
return request(req);
|
|
|
}
|
|
|
|
|
|
-Response get(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response get(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_GET, url, NoBody, headers);
|
|
|
}
|
|
|
|
|
|
-Response options(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response options(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_OPTIONS, url, NoBody, headers);
|
|
|
}
|
|
|
|
|
|
-Response head(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response head(const char* url, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_HEAD, url, NoBody, headers);
|
|
|
}
|
|
|
|
|
|
-Response post(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response post(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_POST, url, body, headers);
|
|
|
}
|
|
|
|
|
|
-Response put(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response put(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_PUT, url, body, headers);
|
|
|
}
|
|
|
|
|
|
-Response patch(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response patch(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_PATCH, url, body, headers);
|
|
|
}
|
|
|
|
|
|
// delete is c++ keyword, we have to replace delete with Delete.
|
|
|
-Response Delete(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
+static inline Response Delete(const char* url, const http_body& body = NoBody, const http_headers& headers = DefaultHeaders) {
|
|
|
return request(HTTP_DELETE, url, body, headers);
|
|
|
}
|
|
|
|