PartialRequestBuilder

sttp.client4.PartialRequestBuilder
trait PartialRequestBuilder[+PR <: PartialRequestBuilder[PR, R], +R] extends HasHeaders, PartialRequestExtensions[PR]

The builder methods of requests or partial requests of type PR.

Type parameters

PR

The type of the request or partial request. The method and uri may not be specified yet.

R

The type of request when the method and uri are specified.

Attributes

Graph
Supertypes
trait HasHeaders
class Object
trait Matchable
class Any
Known subtypes
class PartialRequest[T]
trait RequestBuilder[R]
trait GenericRequest[T, R]
class Request[T]
class StreamRequest[T, R]
class WebSocketRequest[F, T]
Show all
Self type
PR

Members list

Value members

Abstract methods

protected def copyWithBody(body: BasicBody): PR
def headers: Seq[Header]
def method(method: Method, uri: Uri): R

Set the method & uri to the given ones.

Set the method & uri to the given ones.

Attributes

Description of how the response body should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it.

Description of how the response body should be handled. Needs to be specified upfront so that the response is always consumed and hence there are no requirements on client code to consume it.

Attributes

def showBasic: String
def tags: Map[String, Any]

Request-specific tags which can be used by backends for logging, metrics, etc. Empty by default.

Request-specific tags which can be used by backends for logging, metrics, etc. Empty by default.

Attributes

def withHeaders(headers: Seq[Header]): PR

Replace all headers with the given ones.

Replace all headers with the given ones.

Attributes

def withOptions(options: RequestOptions): PR

Replace all options with the given ones.

Replace all options with the given ones.

Attributes

def withTags(tags: Map[String, Any]): PR

Replace all tags with the given ones.

Replace all tags with the given ones.

Attributes

Concrete methods

def acceptEncoding(encoding: String): PR
def body(b: String): PR

Uses the utf-8 encoding.

Uses the utf-8 encoding.

If content type is not yet specified, will be set to text/plain with utf-8 encoding.

If content length is not yet specified, will be set to the number of bytes in the string using the utf-8 encoding.

Attributes

def body(b: String, encoding: String): PR

If content type is not yet specified, will be set to text/plain with the given encoding.

If content type is not yet specified, will be set to text/plain with the given encoding.

If content length is not yet specified, will be set to the number of bytes in the string using the given encoding.

Attributes

def body(b: Array[Byte]): PR

If content type is not yet specified, will be set to application/octet-stream.

If content type is not yet specified, will be set to application/octet-stream.

If content length is not yet specified, will be set to the length of the given array.

Attributes

def body(b: ByteBuffer): PR

If content type is not yet specified, will be set to application/octet-stream.

If content type is not yet specified, will be set to application/octet-stream.

Attributes

def body(b: InputStream): PR

If content type is not yet specified, will be set to application/octet-stream.

If content type is not yet specified, will be set to application/octet-stream.

Attributes

def body(fs: Map[String, String]): PR

Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

Attributes

def body(fs: Map[String, String], encoding: String): PR

Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

Attributes

def body(fs: (String, String)*): PR

Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

Encodes the given parameters as form data using utf-8. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

Attributes

def body(fs: Seq[(String, String)], encoding: String): PR

Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

Encodes the given parameters as form data. If content type is not yet specified, will be set to application/x-www-form-urlencoded.

If content length is not yet specified, will be set to the length of the number of bytes in the url-encoded parameter string.

Attributes

def contentLength(l: Long): PR
def contentType(ct: String): PR
def contentType(mt: MediaType): PR
def contentType(ct: String, encoding: String): PR
def cookies(r: Response[_]): PR

Adds the cookies from the given response. Any previously defined cookies are left intact.

Adds the cookies from the given response. Any previously defined cookies are left intact.

Attributes

def cookies(cs: Iterable[CookieWithMeta]): PR

Adds the given cookies. Any previously defined cookies are left intact.

Adds the given cookies. Any previously defined cookies are left intact.

Attributes

def cookies(nvs: (String, String)*): PR

Adds the given cookies. Any previously defined cookies are left intact.

Adds the given cookies. Any previously defined cookies are left intact.

Attributes

def delete(uri: Uri): R
def followRedirects(fr: Boolean): PR
def get(uri: Uri): R
def head(uri: Uri): R
def header(h: Header, onDuplicate: DuplicateHeaderBehavior): PR

Adds the given header to the headers of this request. If a header with the same name already exists, the default is to replace it with the given one.

Adds the given header to the headers of this request. If a header with the same name already exists, the default is to replace it with the given one.

Value parameters

onDuplicate

What should happen if there's already a header with the same name. The default is to replace.

Attributes

def header(k: String, v: String, onDuplicate: DuplicateHeaderBehavior): PR

Adds the given header to the headers of this request.

Adds the given header to the headers of this request.

Value parameters

onDuplicate

What should happen if there's already a header with the same name. See header.

Attributes

def header(k: String, v: String): PR

Adds the given header to the headers of this request. If a header with the same name already exists, it's replaced.

Adds the given header to the headers of this request. If a header with the same name already exists, it's replaced.

Attributes

def header(k: String, ov: Option[String]): PR

Adds the given header to the headers of this request, if the value is defined. Otherwise has no effect. If a header with the same name already exists, it's replaced.

Adds the given header to the headers of this request, if the value is defined. Otherwise has no effect. If a header with the same name already exists, it's replaced.

Attributes

def headers(hs: Map[String, String]): PR

Adds the given headers to the headers of this request. If a header with the same name already exists, it's replaced.

Adds the given headers to the headers of this request. If a header with the same name already exists, it's replaced.

Attributes

def headers(hs: Header*): PR

Adds the given headers to the headers of this request. If a header with the same name already exists, it's replaced.

Adds the given headers to the headers of this request. If a header with the same name already exists, it's replaced.

Attributes

def httpVersion(version: HttpVersion): PR

Allows setting HTTP version per request. Supported only is a few backends

Allows setting HTTP version per request. Supported only is a few backends

Value parameters

version:

one of values from HttpVersion enum.

Attributes

Returns

request with version tag

def httpVersion: Option[HttpVersion]

GetHttpVersion from tags in request. Supported only is a few backends

GetHttpVersion from tags in request. Supported only is a few backends

Attributes

Returns

one of values form HttpVersion enum or None

def logSettings(logRequestBody: Option[Boolean], logResponseBody: Option[Boolean], logRequestHeaders: Option[Boolean], logResponseHeaders: Option[Boolean]): PR

Will only have effect when using the LoggingBackend

Will only have effect when using the LoggingBackend

Attributes

def logSettings(loggingOptions: Option[LoggingOptions]): PR
def maxRedirects(n: Int): PR
def multipartBody(ps: Seq[Part[BasicBodyPart]]): PR
def multipartBody(p1: Part[BasicBodyPart], ps: Part[BasicBodyPart]*): PR
def options(uri: Uri): R
def patch(uri: Uri): R
def post(uri: Uri): R
def put(uri: Uri): R
def readTimeout(t: Duration): PR

When the request is sent, if reading the response times out (there's no activity for the given period of time), a failed effect will be returned, or an exception will be thrown

When the request is sent, if reading the response times out (there's no activity for the given period of time), a failed effect will be returned, or an exception will be thrown

Attributes

def redirectToGet(r: Boolean): PR

When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.

When a POST or PUT request is redirected, should the redirect be a POST/PUT as well (with the original body), or should the request be converted to a GET without a body.

Note that this only affects 301 and 302 redirects. 303 redirects are always converted, while 307 and 308 redirects always keep the same method.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Redirections for details.

Attributes

def show(includeBody: Boolean, includeHeaders: Boolean, sensitiveHeaders: Set[String]): String
def tag(k: String, v: Any): PR
def tag(k: String): Option[Any]
def withBody(body: BasicBody): PR

Inherited methods

def body[B : BodySerializer](b: B): PR

If content type is not yet specified, will be set to application/octet-stream.

If content type is not yet specified, will be set to application/octet-stream.

Attributes

Inherited from:
PartialRequestExtensions
def body(file: File): PR

If content type is not yet specified, will be set to application/octet-stream.

If content type is not yet specified, will be set to application/octet-stream.

If content length is not yet specified, will be set to the length of the given file.

Attributes

Inherited from:
PartialRequestExtensions
def contentLength: Option[Long]

Attributes

Inherited from:
HasHeaders
def contentType: Option[String]

Attributes

Inherited from:
HasHeaders
def cookies: Seq[Either[String, CookieWithMeta]]

Attributes

Inherited from:
HasHeaders
def header(h: String): Option[String]

Attributes

Inherited from:
HasHeaders
def headers(h: String): Seq[String]

Attributes

Inherited from:
HasHeaders
def unsafeCookies: Seq[CookieWithMeta]

Attributes

Inherited from:
HasHeaders