Part

sttp.model.Part
See thePart companion object
case class Part[+T](name: String, body: T, otherDispositionParams: Map[String, String], headers: Seq[Header]) extends HasHeaders

A decoded representation of a multipart part.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait HasHeaders
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Returns the value of the Content-Disposition header, which should be used when sending this part in a multipart request.

Returns the value of the Content-Disposition header, which should be used when sending this part in a multipart request.

The syntax is specified by RFC6266 section 4.1. For safety and simplicity, disposition parameter values are represented as quoted-string, defined in RFC9110 section 5.6.4.

quoted-string allows usage of visible ASCII characters (%x21-7E), except for " and \, which must be escaped with a backslash. Additionally, space and horizontal tab is allowed, as well as octets 0x80-FF (obs-data). In practice this means that - while not explicitly allowed - non-ASCII UTF-8 characters are valid according to this grammar. Additionally, RFC6532 makes it more explicit that non-ASCII UTF-8 is allowed. Control characters are not allowed.

This method makes sure that " and \ are escaped, while leaving possible rejection of forbidden characters to lower layers (sttp backends).

Attributes

def contentType(v: MediaType): Part[T]
def contentType(v: String): Part[T]
override def contentType: Option[String]

Attributes

Definition Classes
def dispositionParam(k: String, v: String): Part[T]
def dispositionParams: Map[String, String]
def dispositionParamsSeq: Seq[(String, String)]
def fileName(v: String): Part[T]
def fileName: Option[String]
def header(h: Header, replaceExisting: Boolean): Part[T]

Adds the given header to the end of the headers sequence.

Adds the given header to the end of the headers sequence.

Value parameters

replaceExisting

If there's already a header with the same name, should it be dropped?

Attributes

def header(k: String, v: String): Part[T]
def header(k: String, v: String, replaceExisting: Boolean): Part[T]

Adds the given header to the end of the headers sequence.

Adds the given header to the end of the headers sequence.

Value parameters

replaceExisting

If there's already a header with the same name, should it be dropped?

Attributes

override def header(h: String): Option[String]

Attributes

Definition Classes

Inherited methods

def contentLength: Option[Long]

Attributes

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

Attributes

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

Attributes

Inherited from:
HasHeaders
def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product

Attributes

Inherited from:
HasHeaders