Response objects are returned as a result of several Splash methods (like splash:http_get or splash:http_post); they are are also passed to some of the callbacks (e.g. splash:on_response and splash:on_response_headers callbacks). These objects contain information about a response.
response.url¶URL of the response. In case of redirects response.url is a last URL.
This field is read-only.
response.status¶HTTP status code of the response.
This field is read-only.
response.ok¶true
for successful responses and false
when error happened.
Example:
local reply = splash:http_get("some-bad-url") -- reply.ok == false
This field is read-only.
response.info¶A Lua table with response data in HAR response format.
This field is read-only.
response.body¶Raw response body (a binary object).
If you want to process response body from Lua use treat.as_string to convert it to a Lua string first.
response.body attribute is not available by default in splash:on_response callbacks; use splash.response_body_enabled or request:enable_response_body to enable it.
response:abort¶Signature: response:abort()
Returns: nil.
Async: no.
Abort reading of the response body. This method is only available if a response is not read yet - currently you can use it only in a splash:on_response_headers callback.
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