HttpRequest
Type of HTTP requests, and its functions.
enum HttpRequestSourceType of HTTP requests.
An HTTP request has a method, a URL, multi-valued headers, and an optional body.
Definitions
def body(r: HttpRequest): Option[String]§ SourceReturns the text body of the request r, or None if absent or binary.
Returns the binary body of the request r, or None if absent or text.
def connectTimeout(r: HttpRequest): Option[Duration]§ SourceReturns the connect timeout of the request r.
def delete(url: String): HttpRequest§ SourceCreates a DELETE request to the given url.
def followRedirects(r: HttpRequest): Bool§ SourceReturns true if the request r follows redirects.
def get(url: String): HttpRequest§ SourceCreates a GET request to the given url.
def head(url: String): HttpRequest§ SourceCreates a HEAD request to the given url.
def method(r: HttpRequest): Method§ SourceReturns the HTTP method of the request r.
def options(url: String): HttpRequest§ SourceCreates an OPTIONS request to the given url.
def patch(url: String): HttpRequest§ SourceCreates a PATCH request to the given url with no body.
Use patchWith to set a body at construction, or withBody/withBodyBytes to add one later.
def patchWith(url: String, body: String): HttpRequest§ SourceCreates a PATCH request to the given url with the given body.
def post(url: String): HttpRequest§ SourceCreates a POST request to the given url with no body.
Use postWith to set a body at construction, or withBody/withBodyBytes to add one later.
def postWith(url: String, body: String): HttpRequest§ SourceCreates a POST request to the given url with the given body.
def put(url: String): HttpRequest§ SourceCreates a PUT request to the given url with no body.
Use putWith to set a body at construction, or withBody/withBodyBytes to add one later.
def putWith(url: String, body: String): HttpRequest§ SourceCreates a PUT request to the given url with the given body.
def requestTimeout(r: HttpRequest): Option[Duration]§ SourceReturns the request timeout of the request r.
def setHeader(name: String, value: String, r: HttpRequest): HttpRequest§ SourceSets the header name to value on the request r, replacing any existing values.
def url(r: HttpRequest): String§ SourceReturns the URL of the request r.
def withAccept(accept: String, r: HttpRequest): HttpRequest§ SourceSets the Accept header to accept on the request r.
def withBearerToken(token: String, r: HttpRequest): HttpRequest§ SourceSets the Authorization header to Bearer <token> on the request r.
def withBody(body: String, r: HttpRequest): HttpRequest§ SourceSets the body of the request r to the given text body.
def withBodyBytes(body: Vector[Int8], r: HttpRequest): HttpRequest§ SourceSets the body of the request r to the given binary body.
def withConnectTimeout(d: Duration, r: HttpRequest): HttpRequest§ SourceSets the connect timeout (time to establish the TCP connection).
def withContentType(contentType: String, r: HttpRequest): HttpRequest§ SourceSets the Content-Type header to contentType on the request r.
def withFollowRedirects(follow: Bool, r: HttpRequest): HttpRequest§ SourceSets whether the request r should follow HTTP redirects.
def withHeader(name: String, value: String, r: HttpRequest): HttpRequest§ SourceAdds the header name with value value to the request r.
If the header already exists, the value is appended to the list of values.
def withHeaders(h: Map[String, List[String]], r: HttpRequest): HttpRequest§ SourceMerges the given headers h into the request r.
For headers that already exist, the new values are appended to the existing values.
def withQueryParam(name: String, value: String, r: HttpRequest): HttpRequest§ SourceAppends a query parameter name=value to the URL of the request r.
The name and value are URL-encoded.
def withQueryParams(params: Map[String, String], r: HttpRequest): HttpRequest§ SourceAppends multiple query parameters to the URL of the request r.
The names and values are URL-encoded.
def withTimeout(d: Duration, r: HttpRequest): HttpRequest§ SourceSets the request timeout (time until response headers are received).