Response Object

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.


URL of the response. In case of redirects response.url is a last URL.

This field is read-only.


HTTP status code of the response.

This field is read-only.


true for successful responses and false when error happened.


local reply = splash:http_get("some-bad-url")
-- reply.ok == false

This field is read-only.


A Lua table with HTTP headers (header name => header value). Keys are header names (strings), values are header values (strings).

Lookups are case-insensitive, so response.headers['content-type'] is the same as response.headers['Content-Type'].

This field is read-only.

A Lua table with response data in HAR response format.

This field is read-only.


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.


A corresponding Request Object.

This field is read-only.


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.