summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-03-23 15:17:32 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2021-06-23 13:53:43 +0200
commit421e771012384a41c34ed32b5d241100fbd7cea2 (patch)
tree01d6ef08ceff810fd0991f611348788c3cf0b8eb /platform/javascript
parent659178e85fed5a7ee80d76329a977ac3943c7d77 (diff)
[Net] Unify HTTPClient request and request_raw.
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/http_client.h.inc1
-rw-r--r--platform/javascript/http_client_javascript.cpp17
2 files changed, 1 insertions, 17 deletions
diff --git a/platform/javascript/http_client.h.inc b/platform/javascript/http_client.h.inc
index 6544d41c98..316bab7ea4 100644
--- a/platform/javascript/http_client.h.inc
+++ b/platform/javascript/http_client.h.inc
@@ -30,7 +30,6 @@
// HTTPClient's additional private members in the javascript platform
-Error make_request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_len);
static void _parse_headers(int p_len, const char **p_headers, void *p_ref);
int js_id = 0;
diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp
index a6cf4b0eb8..1443197e33 100644
--- a/platform/javascript/http_client_javascript.cpp
+++ b/platform/javascript/http_client_javascript.cpp
@@ -105,7 +105,7 @@ Ref<StreamPeer> HTTPClient::get_connection() const {
ERR_FAIL_V_MSG(REF(), "Accessing an HTTPClient's StreamPeer is not supported for the HTML5 platform.");
}
-Error HTTPClient::make_request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_len) {
+Error HTTPClient::request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_len) {
ERR_FAIL_INDEX_V(p_method, METHOD_MAX, ERR_INVALID_PARAMETER);
ERR_FAIL_COND_V_MSG(p_method == METHOD_TRACE || p_method == METHOD_CONNECT, ERR_UNAVAILABLE, "HTTP methods TRACE and CONNECT are not supported for the HTML5 platform.");
ERR_FAIL_COND_V(status != STATUS_CONNECTED, ERR_INVALID_PARAMETER);
@@ -128,21 +128,6 @@ Error HTTPClient::make_request(Method p_method, const String &p_url, const Vecto
return OK;
}
-Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector<String> &p_headers, const Vector<uint8_t> &p_body) {
- if (p_body.is_empty()) {
- return make_request(p_method, p_url, p_headers, nullptr, 0);
- }
- return make_request(p_method, p_url, p_headers, p_body.ptr(), p_body.size());
-}
-
-Error HTTPClient::request(Method p_method, const String &p_url, const Vector<String> &p_headers, const String &p_body) {
- if (p_body.is_empty()) {
- return make_request(p_method, p_url, p_headers, nullptr, 0);
- }
- const CharString cs = p_body.utf8();
- return make_request(p_method, p_url, p_headers, (const uint8_t *)cs.get_data(), cs.size() - 1);
-}
-
void HTTPClient::close() {
host = "";
port = -1;