Request objects are received by splash:on_request callbacks; they are also available as response.request.
Attributes¶Request objects has several attributes with information about a HTTP request. These fields are for information only; changing them doesnât change the request to be sent.
request.url¶Requested URL.
request.method¶HTTP method name in upper case, e.g. âGETâ.
Methods¶To change or drop the request before sending use one of the request
methods. Note that these methods are only available before the request is sent (they has no effect if a request is already sent). Currently it means you can only use them in splash:on_request callbacks.
Drop the request.
Signature: request:abort()
Returns: nil.
Async: no.
request:enable_response_body¶Enable tracking of response content (i.e. response.body attribute).
Signature: request:enable_response_body()
Returns: nil.
Async: no.
This function allows to enable response content tracking per-request when splash.response_body_enabled is set to false. Call it in a splash:on_request callback.
request:set_url¶Change request URL to a specified value.
Signature: request:set_url(url)
Parameters:
Returns: nil.
Async: no.
request:set_proxy¶Set a proxy server to use for this request.
Signature: request:set_proxy{host, port, username=nil, password=nil, type='HTTP'}
Parameters:
Returns: nil.
Async: no.
Omit username
and password
arguments if a proxy doesnât need auth.
When type
is set to âHTTPâ HTTPS proxying should also work; it is implemented using CONNECT command.
Set a timeout for this request.
Signature: request:set_timeout(timeout)
Parameters:
Returns: nil.
Async: no.
If response is not fully received after the timeout, request is aborted. See also: splash.resource_timeout.
request:set_http2_enabled¶Enable or disable HTTP2 support for this request.
Signature: request:set_http2_enabled(true/false)
Parameters:
Returns: nil.
Async: no.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4