ServerRequest

sttp.tapir.model.ServerRequest
trait ServerRequest extends RequestMetadata

Implement for specific request representation of a particular server. Consider overriding ServerRequest#uri and ServerRequest#showShort for a backend-specific implementation of constructing the Uri and printing the path + query params. This way you'll avoid a performance overhead of parsing sttp.model.Uri. See https://softwaremill.com/benchmarking-tapir-part-2/ for more details.

Attributes

Graph
Supertypes
trait RequestMetadata
trait HasHeaders
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def attribute[T](k: AttributeKey[T]): Option[T]
def attribute[T](k: AttributeKey[T], v: T): ServerRequest
def pathSegments: List[String]

Can differ from uri.path, if the endpoint is deployed in a context

Can differ from uri.path, if the endpoint is deployed in a context

Attributes

def protocol: String
def queryParameters: QueryParams
def underlying: Any
def withUnderlying(underlying: Any): ServerRequest

Create a copy of this server request, which reads data from the given underlying implementation. The type of underlying should be the same as the type of this.underlying.

Create a copy of this server request, which reads data from the given underlying implementation. The type of underlying should be the same as the type of this.underlying.

Attributes

Concrete methods

def showShort: String

A short representation of this request, including the request method, path and query.

A short representation of this request, including the request method, path and query.

Attributes

def withOverride(methodOverride: Option[Method], uriOverride: Option[Uri], protocolOverride: Option[String], connectionInfoOverride: Option[ConnectionInfo], pathSegmentsOverride: Option[List[String]], queryParametersOverride: Option[QueryParams], headersOverride: Option[Seq[Header]]): ServerRequest

Create a copy of this server request, which overrides some of the data that is read from the underlying implementation with the given values. E.g. instead of reading the headers from the underlying request, the headers might be given explicitly.

Create a copy of this server request, which overrides some of the data that is read from the underlying implementation with the given values. E.g. instead of reading the headers from the underlying request, the headers might be given explicitly.

Attributes

Inherited methods

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 headers: Seq[Header]

Attributes

Inherited from:
HasHeaders
def method: Method

Attributes

Inherited from:
RequestMetadata
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
RequestMetadata -> Any
Inherited from:
RequestMetadata
def unsafeCookies: Seq[CookieWithMeta]

Attributes

Inherited from:
HasHeaders
def uri: Uri

Attributes

Inherited from:
RequestMetadata

Concrete fields

lazy val acceptsContentTypes: Either[String, Seq[ContentTypeRange]]
lazy val contentTypeParsed: Option[MediaType]