Responses
Type members
Classlikes
Inherited classlikes
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
- Inherited from:
- InvariantFunctorSyntax
Types
An HTTP response (status, headers, and entity) carrying an information of type A
An HTTP response (status, headers, and entity) carrying an information of type A
Values of type Response[A]
can be constructed by using the operations
ok, badRequest, internalServerError, or the more general operation
response.
- Note:
This type has implicit methods provided by the InvariantFunctorSyntax and ResponseSyntax classes
An HTTP response entity carrying an information of type A
An HTTP response entity carrying an information of type A
Values of type ResponseEntity can be constructed by using the operations emptyResponse or textResponse. Additional types of response entities are provided by other algebra modules, such as JsonEntities or ChunkedEntities.
- Note:
This type has implicit methods provided by the InvariantFunctorSyntax class
Information carried by responses’ headers.
Information carried by responses’ headers.
You can construct values of type ResponseHeaders
by using the operations responseHeader,
optResponseHeader, or emptyResponseHeaders.
- Note:
This type has implicit methods provided by the SemigroupalSyntax and InvariantFunctorSyntax classes.
Inherited types
Value members
Abstract methods
Alternative between two possible choices of responses.
Alternative between two possible choices of responses.
Server interpreters construct either one or the other response. Client interpreters accept either one or the other response. Documentation interpreters list all the possible responses.
Empty response entity
Empty response entity
- Server interpreters produce no response entity,
- Client interpreters ignore the response entity.
No particular response header.
No particular response header.
- Client interpreters should ignore information carried by response headers.
Response headers optionally containing a header with the given name
.
Response headers optionally containing a header with the given name
.
- Client interpreters should model the header value as
Some[String]
, orNone
if the response header is missing. - Server interpreters should produce such a response header.
- Documentation interpreters should document this header.
Define an HTTP response
Define an HTTP response
- Server interpreters construct a response with the given status and entity.
- Client interpreters accept a response only if it has a corresponding status code.
- Value parameters:
- docs
Response documentation
- entity
Response entity
- headers
Response headers
- statusCode
Response status code
Response headers containing a header with the given name
.
Response headers containing a header with the given name
.
- Client interpreters should model the header value as
String
, or fail if the response header is missing. - Server interpreters should produce such a response header.
- Documentation interpreters should document this header.
Example:
val versionedResource: Endpoint[Unit, (SomeResource, String)] =
endpoint(
get(path / "versioned-resource"),
ok(
jsonResponse[SomeResource],
headers = responseHeader("ETag")
)
)
Concrete methods
Add the provided headers
to the response
.
Add the provided headers
to the response
.
Note that if the response
describes a choice of several
possible responses (resulting from the orElse
operation),
the headers
will be added to all the possible responses.
Bad Request (400) response, with an entity of type ClientErrors
.
Bad Request (400) response, with an entity of type ClientErrors
.
- See also:
Internal Server Error (500) response, with an entity of type ServerError
.
Internal Server Error (500) response, with an entity of type ServerError
.
- See also:
OK (200) Response with the given entity
OK (200) Response with the given entity
Turns a Response[A]
into a Response[Option[A]]
.
Turns a Response[A]
into a Response[Option[A]]
.
Interpreters represent None
with
an empty HTTP response whose status code is 404 (Not Found).
Inherited methods
- Note:
You should use the
badRequest
constructor provided by the endpoints4s.algebra.Responses trait to ensure that errors produced by endpoints4s are consistently handled by interpreters.- Inherited from:
- StatusCodes
- Note:
You should use the
internalServerError
constructor provided by the endpoints4s.algebra.Responses trait to ensure that errors produced by endpoints4s are consistently handled by interpreters.- Inherited from:
- StatusCodes
Implicits
Implicits
Inherited implicits
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
Extension methods for values of type F[A]
for which there is an implicit
InvariantFunctor[F]
instance.
- Inherited from:
- InvariantFunctorSyntax