zhttp.http
Type members
Classlikes
Represents an immutable collection of headers i.e. essentially a Chunk[(String, String)]. It extends HeaderExtensions and has a ton of powerful operators that can be used to add, remove and modify headers.
Represents an immutable collection of headers i.e. essentially a Chunk[(String, String)]. It extends HeaderExtensions and has a ton of powerful operators that can be used to add, remove and modify headers.
NOTE: Generic operators that are not specific to Headers should not be
defined here. A better place would be one of the traits extended by
HeaderExtension.
- Companion:
- object
A functional domain to model Http apps using ZIO and that can work over any kind of request and response types.
A functional domain to model Http apps using ZIO and that can work over any kind of request and response types.
- Companion:
- object
Holds HttpData that needs to be written on the HttpChannel
Holds HttpData that needs to be written on the HttpChannel
- Companion:
- object
- Companion:
- object
Middlewares are essentially transformations that one can apply on any Http to produce a new one. They can modify requests and responses and also transform them into more concrete domain entities.
Middlewares are essentially transformations that one can apply on any Http to produce a new one. They can modify requests and responses and also transform them into more concrete domain entities.
You can think of middlewares as a functions —
type Middleware[R, E, AIn, BIn, AOut, BOut] = Http[R, E, AIn, BIn] => Http[R, E, AOut, BOut]
The AIn and BIn type params represent the type params of the input Http.
The AOut and BOut type params represent the type params of the output
Http.
- Companion:
- object
Models the set of operations that one would want to apply on a Response.
Models the set of operations that one would want to apply on a Response.
- Companion:
- object
- Companion:
- object
Instead of using just String as path params, using the RouteDecoderModule
we can extract and converted params into a specific type also.
Instead of using just String as path params, using the RouteDecoderModule
we can extract and converted params into a specific type also.
Http.collect[Request] {
case GET -> !! / "user" / int(id) => Response.text("User id requested: ${id}")
case GET -> !! / "user" / name => Response.text("User name requested: ${name}")
}
If the request looks like GET /user/100 then it would match the first case.
This is because internally the id param can be decoded into an Int. If a
request of the form GET /user/zio is made, in that case the second case is
matched.