The path with the query string or just the path if there is no query string
Sends this request.
Sends this request.
A request can be sent multiple times. When a request is sent, it returns a Future[HttpResponse] which either succeeds with an HttpResponse or fails with an HttpNetworkError.
Possible reasons for the future failing are: - A status code >= 400 - A network error
Note that in some cases the response body can still be obtained after a failure through the HttpNetworkError.
A future of HttpResponse which may fail with an HttpNetworkError
The target url for this request
Adds or updates a header to the current set of headers.
Adds or updates a header to the current set of headers.
The header key (case insensitive)
The header value
A copy of this HttpRequest with an updated header set.
Adds or updates multiple headers to the current set of headers.
Adds or updates multiple headers to the current set of headers.
The headers to add.
A copy of this HttpRequest with an updated header set.
Sets the host used in the request URI.
Sets the host used in the request URI.
The new host
A copy of this HttpRequest with an updated host
Sets the path used in the request URI.
Sets the path used in the request URI.
The path is the part that lies between the host (or port if present) and the query string or the end of the request. Note that the query string is not part of the path.
The new path, including the leading '/' and excluding any '?' or '#' and subsequent characters
A copy of this HttpRequest with an updated path
Sets the port used in the request URI.
Sets the port used in the request URI.
The new port
A copy of this HttpRequest with an updated port
Sets the protocol used in the request URL.
Sets the protocol used in the request URL.
At the moment, only HTTP is supported.
The HTTP protocol
A copy of this HttpRequest with an updated protocol
IllegalArgumentException
when something else than HTTP is passed as argument
Adds a query map parameter or updates it if it already exists.
Adds a query map parameter or updates it if it already exists.
Although this is not part of a spec, most servers recognize bracket indices in a query string as array indices or object keys.
example: ?obj[foo]=bar&obj[baz]=42
This method formats map values according to the above example.
The unescaped parameter key
The unescaped parameter map values
A copy of this HttpRequest with an updated query string.
withQueryParameter(String,String)
Adds a query array parameter or updates it if it already exists.
Adds a query array parameter or updates it if it already exists.
Although this is not part of a spec, most servers recognize bracket indices in a query string as array indices or object keys.
example: ?list[0]=foo&list[1]=bar
This method formats array values according to the above example.
The unescaped parameter key
The unescaped parameter array values
A copy of this HttpRequest with an updated query string.
withQueryParameter(String,String)
Adds a query parameter or updates it if it already exists.
Adds a query parameter or updates it if it already exists.
Query parameters end up in the query string as key=value
pairs separated by ampersands.
Both the key and parameter are escaped to ensure proper query string format.
The unescaped parameter key
The unescaped parameter value
A copy of this HttpRequest with an updated query string.
Adds multiple query parameters and updates those already existing.
Adds multiple query parameters and updates those already existing.
A map of new parameters.
A copy of this HttpRequest with an updated query string.
withQueryParameter(String,String)
Sets the query string.
Sets the query string.
The argument is escaped by this method. If you want to bypass the escaping, use withQueryStringRaw.
Escaping also means that the queryString property will generally not be equal to what you passed as argument to withQueryString.
For instance: request.withQueryString("äéuô").queryString.get != "%C3%A4%C3%A9u%C3%B4"
The unescaped query string.
A copy of this HttpRequest with an updated queryString
Sets the query string without escaping.
Sets the query string without escaping.
Raw query strings must only contain legal characters as per rfc3986. Adding special characters yields undefined behaviour.
In most cases, withQueryString should be preferred.
The raw, escaped query string
A copy of this HttpRequest with an updated queryString
Updates request protocol, host, port, path and queryString according to a url.
Updates request protocol, host, port, path and queryString according to a url.
A valid HTTP url
A copy of this HttpRequest with updated URL-related attributes.
Removes the query string.
Removes the query string.
A copy of this HttpRequest without query string
Builds an HTTP request.
The request is sent using send. A request can be sent multiple times. Each time yields a Future[HttpResponse] which either succeeds with an HttpResponse or fails with an HttpNetworkError