From 5c7e9e7e633088fae7e9c9e30c3814a1b2a7207c Mon Sep 17 00:00:00 2001 From: Aren Villanueva Date: Wed, 18 Nov 2015 22:33:29 +1100 Subject: Fixes the make_doc.sh, <, > and & signs in descriptions that cause the parser to break. Documentation for HTTPClient. Added a query_string_from_dict method to HTTPClient to create a x-www-form-urlencoded valid query string for GET and POST messages. String now has http_escape() and http_unescape() methods to help facilitate the above query_string_from_dict method. --- doc/base/classes.xml | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) (limited to 'doc/base') diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 24c5799350..e805adce6d 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -12518,9 +12518,13 @@ This approximation makes straight segments between each point, then subdivides t - + + Connect to a host. This needs to be done before any requests are sent. +The host should not have http:// prepended but will strip the protocol identifier if provided. + +verify_host will check the SSL identity of the host if set to true. @@ -12541,6 +12545,20 @@ This approximation makes straight segments between each point, then subdivides t + Sends a request to the connected host. The url is the what is normally behind the hostname, +i.e; +http://somehost.com/index.php +url would be "index.php" + +Headers are HTTP request headers + +To create a POST request with query strings to push to the server, do: +var fields = {"username" : "user", + "password" : "pass"} +var queryString = httpClient.query_string_from_dict(fields) +var headers = ["Content-Type: application/x-www-form-urlencoded", + "Content-Length: " + str(queryString.length())] +var result = httpClient.request(httpClient.METHOD_POST, "index.php", headers, queryString) @@ -12548,7 +12566,8 @@ This approximation makes straight segments between each point, then subdivides t - + + Stub function @@ -12557,6 +12576,7 @@ This approximation makes straight segments between each point, then subdivides t + Stub function @@ -12609,12 +12629,14 @@ This approximation makes straight segments between each point, then subdivides t + Sets the size of the buffer used and maximum bytes to read per iteration + If set to true, execute will wait until all data is read from the response. @@ -12627,14 +12649,30 @@ This approximation makes straight segments between each point, then subdivides t + Returns a status string like STATUS_REQUESTING. Need to call [method poll] in order to get status updates. - - - + + This needs to be called in order to have any request processed. Check results with [method get_status] + + + + + + + + + Generates a GET/POST application/x-www-form-urlencoded style query string from a provided dictionary. + +var fields = {"username": "user", "password": "pass"} +String queryString = httpClient.query_string_from_dict(fields) + +returns:= "username=user&password=pass" + + -- cgit v1.2.3