Fix doc description of HTTPClient::request
(cherry picked from commit 422f821be9
)
This commit is contained in:
parent
bcfa5beb8d
commit
a29b834930
1 changed files with 5 additions and 3 deletions
|
@ -144,14 +144,15 @@
|
|||
<argument index="3" name="body" type="String" default="""">
|
||||
</argument>
|
||||
<description>
|
||||
Sends a request to the connected host. The URL parameter is just the part after the host, so for [code]http://somehost.com/index.php[/code], it is [code]index.php[/code].
|
||||
Sends a request to the connected host.
|
||||
The URL parameter is usually just the part after the host, so for [code]http://somehost.com/index.php[/code], it is [code]/index.php[/code]. When sending requests to an HTTP proxy server, it should be an absolute URL. For [constant HTTPClient.METHOD_OPTIONS] requests, [code]*[/code] is also allowed. For [constant HTTPClient.METHOD_CONNECT] requests, it should be the authority component ([code]host:port[/code]).
|
||||
Headers are HTTP request headers. For available HTTP methods, see [enum Method].
|
||||
To create a POST request with query strings to push to the server, do:
|
||||
[codeblock]
|
||||
var fields = {"username" : "user", "password" : "pass"}
|
||||
var query_string = http_client.query_string_from_dict(fields)
|
||||
var headers = ["Content-Type: application/x-www-form-urlencoded", "Content-Length: " + str(query_string.length())]
|
||||
var result = http_client.request(http_client.METHOD_POST, "index.php", headers, query_string)
|
||||
var result = http_client.request(http_client.METHOD_POST, "/index.php", headers, query_string)
|
||||
[/codeblock]
|
||||
[b]Note:[/b] The [code]request_data[/code] parameter is ignored if [code]method[/code] is [constant HTTPClient.METHOD_GET]. This is because GET methods can't contain request data. As a workaround, you can pass request data as a query string in the URL. See [method String.http_escape] for an example.
|
||||
</description>
|
||||
|
@ -168,7 +169,8 @@
|
|||
<argument index="3" name="body" type="PoolByteArray">
|
||||
</argument>
|
||||
<description>
|
||||
Sends a raw request to the connected host. The URL parameter is just the part after the host, so for [code]http://somehost.com/index.php[/code], it is [code]index.php[/code].
|
||||
Sends a raw request to the connected host.
|
||||
The URL parameter is usually just the part after the host, so for [code]http://somehost.com/index.php[/code], it is [code]/index.php[/code]. When sending requests to an HTTP proxy server, it should be an absolute URL. For [constant HTTPClient.METHOD_OPTIONS] requests, [code]*[/code] is also allowed. For [constant HTTPClient.METHOD_CONNECT] requests, it should be the authority component ([code]host:port[/code]).
|
||||
Headers are HTTP request headers. For available HTTP methods, see [enum Method].
|
||||
Sends the body data raw, as a byte array and does not encode it in any way.
|
||||
</description>
|
||||
|
|
Loading…
Reference in a new issue