HttpRequest

org.llm4s.http.HttpRequest
See theHttpRequest companion object
@Stable
final case class HttpRequest

One HTTP request, as Llm4sHttpClient.send takes it.

The two timeouts bound different waits, and neither is a deadline for the whole exchange:

  • responseTimeout is the longest wait, from sending the request, for the response's status line and headers. It covers connecting too, unless the client was created with a shorter connect timeout.
  • idleTimeout is the longest a read of the response body waits for more bytes. It is not measured while the caller is busy between reads, so a slow consumer never trips it, and a stream that keeps delivering may run for any length of time.

Build one with HttpRequest.apply and change it with the with* setters; the constructor and copy are private, so a new field never breaks callers. toString leaves the headers and query out, since either may carry a credential.

Value parameters

body

the request body

headers

request headers, single-valued

idleTimeout

the longest a read of the response body waits for more bytes

method

the HTTP method

queryParams

query parameters, URL-encoded and appended to url by fullUrl

responseTimeout

the longest wait for the response's status line and headers

url

absolute http or https URL; queryParams are appended to it

Attributes

Companion
object
Source
Llm4sHttpClient.scala
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

url with queryParams form-encoded and appended, after any query it already has.

url with queryParams form-encoded and appended, after any query it already has.

Attributes

Source
Llm4sHttpClient.scala
override def toString: String

Returns a string representation of the object.

Returns a string representation of the object.

The default representation is platform dependent.

Attributes

Returns

a string representation of the object.

Definition Classes
Any
Source
Llm4sHttpClient.scala

Sets the request body.

Sets the request body.

Attributes

Source
Llm4sHttpClient.scala

Sets a body of bytes.

Sets a body of bytes.

Attributes

Source
Llm4sHttpClient.scala
def withHeader(name: String, value: String): HttpRequest

Adds or replaces one request header.

Adds or replaces one request header.

Attributes

Source
Llm4sHttpClient.scala

Replaces the request headers.

Replaces the request headers.

Attributes

Source
Llm4sHttpClient.scala

Sets the longest a read of the response body waits for more bytes.

Sets the longest a read of the response body waits for more bytes.

Attributes

Source
Llm4sHttpClient.scala

Sets the HTTP method.

Sets the HTTP method.

Attributes

Source
Llm4sHttpClient.scala

Sets a multipart/form-data body.

Sets a multipart/form-data body.

Attributes

Source
Llm4sHttpClient.scala

This request with a HttpBody.Multipart body encoded: the body becomes HttpBody.Bytes and Content-Type names the boundary. Field and file names are escaped (", CR and LF percent-encoded) and files are read here, so a file that cannot be read, or a part content type holding a line break, is a Left(ValidationError). A request with any other body is returned unchanged.

This request with a HttpBody.Multipart body encoded: the body becomes HttpBody.Bytes and Content-Type names the boundary. Field and file names are escaped (", CR and LF percent-encoded) and files are read here, so a file that cannot be read, or a part content type holding a line break, is a Left(ValidationError). A request with any other body is returned unchanged.

For an Llm4sHttpClient whose transport has no multipart support of its own.

Attributes

Source
Llm4sHttpClient.scala

Replaces the query parameters appended to the URL.

Replaces the query parameters appended to the URL.

Attributes

Source
Llm4sHttpClient.scala

Sets the longest wait for the response's status line and headers.

Sets the longest wait for the response's status line and headers.

Attributes

Source
Llm4sHttpClient.scala

Sets a text body, sent as UTF-8.

Sets a text body, sent as UTF-8.

Attributes

Source
Llm4sHttpClient.scala

Sets both timeouts to timeout: the wait for the response head, and each wait for more of the body.

Sets both timeouts to timeout: the wait for the response head, and each wait for more of the body.

Attributes

Source
Llm4sHttpClient.scala

Sets the URL, without the queryParams.

Sets the URL, without the queryParams.

Attributes

Source
Llm4sHttpClient.scala

Inherited methods

Attributes

Inherited from:
Product

Attributes

Inherited from:
Product