diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2016-04-18 13:50:09 +0200 |
---|---|---|
committer | Rémi Verschelde <remi@verschelde.fr> | 2016-04-18 13:50:09 +0200 |
commit | fd07ef07fa9058e3fc6c72c246a4db421336c346 (patch) | |
tree | 641677bc2ce2b1e4a75c8be44667e962d631c620 | |
parent | df13fdf0e93b1ef3ce4e12dfca0fcd38086eb0ed (diff) | |
parent | 0ca7e192423e743db3ded3822ae70888a523a35e (diff) |
Merge pull request #4345 from mownier/add/getter/http-client-connection
Added getter method for the connection property in HTTPClient.
-rw-r--r-- | core/io/http_client.cpp | 7 | ||||
-rw-r--r-- | core/io/http_client.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index e0c01c9422..8c58e0ba5e 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -81,6 +81,12 @@ void HTTPClient::set_connection(const Ref<StreamPeer>& p_connection){ } +Ref<StreamPeer> HTTPClient::get_connection() const { + + return connection; +} + + Error HTTPClient::request( Method p_method, const String& p_url, const Vector<String>& p_headers,const String& p_body) { ERR_FAIL_INDEX_V(p_method,METHOD_MAX,ERR_INVALID_PARAMETER); @@ -578,6 +584,7 @@ void HTTPClient::_bind_methods() { ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); + ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); ObjectTypeDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text); ObjectTypeDB::bind_method(_MD("send_body_data","body"),&HTTPClient::send_body_data); diff --git a/core/io/http_client.h b/core/io/http_client.h index e795646c70..defde08524 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -168,6 +168,7 @@ public: Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); void set_connection(const Ref<StreamPeer>& p_connection); + Ref<StreamPeer> get_connection() const; Error request( Method p_method, const String& p_url, const Vector<String>& p_headers,const String& p_body=String()); Error send_body_text(const String& p_body); |