crawlie v1.0.0 Crawlie.Response
Defines the struct representing a page retrieved by the http client.
Summary
Types
The Crawlie.Response
struct type
Functions
Retrieves the (downcased) content type of the response
Retrieves the (downcased) content type of the response, just the “type/subtype” part, with no additional parameters, if there are any in the Content-Type header value
Constructs the Crawlie.Response
struct
Returns the string representation of the uri
contained in the Crawlie.Response
struct
Types
Functions
Retrieves the (downcased) content type of the response.
Deprecated, you can use response.content_type
directly
Example
iex> alias Crawlie.Response
iex> url = "https://foo.bar/"
iex> headers = [{"Content-Type", "text/html; charset=UTF-8"}]
iex> response = Response.new(url, 200, headers, "<html />")
iex> Response.content_type(response)
"text/html; charset=utf-8"
iex> Response.content_type(response) == response.content_type
true
Retrieves the (downcased) content type of the response, just the “type/subtype” part, with no additional parameters, if there are any in the Content-Type header value.
Deprecated, you can use response.content_type_simple
directly
Example
iex> alias Crawlie.Response
iex> url = "https://foo.bar/"
iex> headers = [{"Content-Type", "text/html; charset=UTF-8"}]
iex> response = Response.new(url, 200, headers, "<html />")
iex> Response.content_type_simple(response)
"text/html"
iex> Response.content_type_simple(response) == response.content_type_simple
true
new(String.t | URI.t, integer, [{String.t, String.t}], binary) :: Crawlie.Response.t
Constructs the Crawlie.Response
struct.
Example
iex> alias Crawlie.Response
iex> url = "https://foo.bar/"
iex> headers = [{"Content-Type", "text/plain"}]
iex> response = Response.new(url, 200, headers, "body")
iex> response.body
"body"
iex> response.status_code
200
Returns the string representation of the uri
contained in the Crawlie.Response
struct.