Sends this request with the GET method.
Sends this request with the GET method.
The path with the query string or just the path if there is no query string
Sends this request with the OPTIONS method and a body
Sends this request with the OPTIONS method and a body
The body to send with the request
Sends this request with the POST method and a body
Sends this request with the POST method and a body
The body to send with the request
Sends this request with the PUT method and a body
Sends this request with the PUT method and a body
The body to send with the request
Sends this request with a body.
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.]]
The target url for this request
Use the provided backend configuration when executing the request
Attaches a body to this request and sets the Content-Type header.
Attaches a body to this request and sets the Content-Type header.
The body will be sent with the request regardless of other parameters once send() is invoked. Any subsequent call to withBody(), send(BodyPart), post(BodyPart), put(BodyPart) or similar methods will override the request body.
The Content-Type header is set to this body's content-type. It can still be manually overridden using a method of the withHeader() family.
Note that the HTTP spec forbids sending data with some methods. In case you need to deal with a broken backend, this library allows you to do so anyway. **Beware that in this case, the JVM can still enforce a compliant HTTP method**.
Allows browser to add a cookie to a cross-domain request, if one was received prior from the server.
Allows browser to add a cookie to a cross-domain request, if one was received prior from the server.
If true, browser is allowed to add cookie to cross-domain request.
A copy of this HttpRequest with an updated header set.
Discards changes introduced by any call to withPort
Discards changes introduced by any call to withPort
A copy of this HttpRequest with no explicit port.
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 HTTP method.
Sets the HTTP method. Defaults to GET.
Beware of browser limitations when using exotic methods.
The new method
A copy of this HttpRequest with an updated method
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.
Setting the protocol also sets the port accordingly (80 for HTTP, 443 for HTTPS).
The HTTP or HTTPS protocol
A copy of this HttpRequest with an updated protocol and port
Adds an object made of key/value pairs to the query string.
Adds an object made of key/value pairs to the query string.
Although this is not part of a spec, most servers recognize bracket indices in a query string as object keys. The same key can appear multiple times as some server will interpret this as multiple elements in an array for that key.
example: ?obj[foo]=bar&obj[baz]=42
The unescaped parameter key
The unescaped parameter map values
A copy of this HttpRequest with an updated query string.
Adds a query parameter key/value pair.
Adds a query parameter key/value pair.
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.
Adds multiple query parameters.
A sequence of new, unescaped parameters.
A copy of this HttpRequest with an updated query string.
Adds a query array parameter.
Adds a query array parameter.
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.
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
Specifies the request timeout.
Specifies the request timeout.
When a request takes longer than timeout to complete, the future is rejected with a fr.hmil.roshttp.exceptions.TimeoutException.
The duration to wait before throwing a timeout exception.
A copu of this HttpRequest with an updated timeout setting.
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.