package http
- Alphabetic
- By Inheritance
- http
- MdInterpolator
- UrlInterpolator
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
Type Members
- trait Body extends AnyRef
Represents the body of a request or response.
Represents the body of a request or response. The body can be a fixed chunk of bytes, a stream of bytes, or form data, or any type that can be encoded into such representations (such as textual data using some character encoding, the contents of files, JSON, etc.).
- final case class Boundary(id: String, charset: Charset) extends Product with Serializable
A multipart boundary, which consists of both the boundary and its charset.
- trait Channel[-In, +Out] extends AnyRef
A
Channelis an asynchronous communication channel that supports receiving messages of typeInand sending messages of typeOut. - sealed trait ChannelEvent[+A] extends AnyRef
Immutable and type-safe representation of events that are triggered on a netty channel.
Immutable and type-safe representation of events that are triggered on a netty channel.
Arepresents the message type. - type Client = ZClient[Any, Body, Throwable, Response]
- trait ClientDriver extends AnyRef
- sealed trait ClientSSLConfig extends AnyRef
- trait ComposeLowPriorityImplicits extends AnyRef
- trait ConnectionPool[Connection] extends AnyRef
- sealed trait ConnectionPoolConfig extends AnyRef
- sealed trait Cookie extends AnyRef
Cookie is an immutable and type-safe representation of an HTTP cookie.
Cookie is an immutable and type-safe representation of an HTTP cookie. There are two types of cookies: request cookies and response cookies. These can be created with the constructors in the companion object of Cookie.
- final case class Credentials(uname: String, upassword: String) extends Product with Serializable
- sealed trait Decompression extends AnyRef
- trait DnsResolver extends AnyRef
- trait Driver extends AnyRef
- final case class Form(formData: Chunk[FormField]) extends Product with Serializable
Represents a form that can be either multipart or url encoded.
- sealed trait FormDecodingError extends Exception
Represents a form decoding error.
- sealed trait FormField extends AnyRef
Represents a field in a form.
Represents a field in a form. Every field contains name, content type (perhaps just plaintext), type-specific content, and an optional filename.
- sealed trait Handler[-R, +Err, -In, +Out] extends AnyRef
- final case class HandlerAspect[-Env, +CtxOut](protocol: ProtocolStack[Env, Request, (Request, CtxOut), Response, Response]) extends Middleware[Env] with Product with Serializable
A zio.http.HandlerAspect is a kind of zio.http.ProtocolStack that is specialized to transform a handler's incoming requests and outgoing responses.
A zio.http.HandlerAspect is a kind of zio.http.ProtocolStack that is specialized to transform a handler's incoming requests and outgoing responses. Each layer in the stack corresponds to a separate transformation.
Layers may incorporate layer-specific information into a generic type parameter, referred to as middleware context, which composes using tupling.
Layers may also be stateful at the level of each transformation application. So, for example, a layer that is timing request durations may capture the start time of the request in the incoming interceptor, and pass this state to the outgoing interceptor, which can then compute the duration.
zio.http.HandlerAspect is more than just a wrapper around zio.http.ProtocolStack, as its concatenation operator has been specialized to entuple contexts, so that each layer may only add context to the contextual output.
- sealed trait Header extends AnyRef
- sealed trait Headers extends HeaderOps[Headers] with Iterable[Header]
Represents an immutable collection of headers.
Represents an immutable collection of headers. 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
Headersshould not be defined here. A better place would be one of the traits extended byHeaderExtension. - final case class HttpApp[-Env](routes: Routes[Env, Response]) extends PartialFunction[Request, ZIO[Env, Response, Response]] with Product with Serializable
An HTTP application is a collection of routes, all of whose errors have been handled through conversion into HTTP responses.
An HTTP application is a collection of routes, all of whose errors have been handled through conversion into HTTP responses.
HTTP applications can be installed into a zio.http.Server, which is capable of using them to serve requests.
- trait MdInterpolator extends AnyRef
- implicit class MdInterpolatorHelper extends AnyRef
- Definition Classes
- MdInterpolator
- final case class MediaType(mainType: String, subType: String, compressible: Boolean = false, binary: Boolean = false, fileExtensions: List[String] = Nil, extensions: Map[String, String] = Map.empty, parameters: Map[String, String] = Map.empty) extends Product with Serializable
- sealed trait Method extends AnyRef
Represents an HTTP method, such as GET, PUT, POST, or DELETE.
- trait Middleware[-UpperEnv] extends AnyRef
- final case class Path extends Product with Serializable
Path is an immutable representation of the path of a URL.
Path is an immutable representation of the path of a URL. Internally it stores each element of a path in a sequence of text, together with flags on whether there are leading and trailing slashes in the path. This allows for a combination of precision and performance and supports a rich API.
- sealed trait ProtocolStack[-Env, -IncomingIn, +IncomingOut, -OutgoingIn, +OutgoingOut] extends AnyRef
A zio.http.ProtocolStack represents a linear stack of protocol layers, each of which can statefully transform incoming and outgoing values of some handler.
A zio.http.ProtocolStack represents a linear stack of protocol layers, each of which can statefully transform incoming and outgoing values of some handler.
Protocol stacks can be thought of as a formal model of the process of transforming one handler into another handler.
Protocol stacks are designed to support precise semantics around error handling. In particular, if a layer successfully processes an incoming value of a handler, then that same layer will also have a chance to process the outgoing value of the handler. This requirement constrains the ways in which layers can fail, and the types of handlers they may be applied to.
In particular, protocol stacks can be applied to handlers that fail with the same type as their output type. This guarantees that should a handler fail, it will still produce an outgoing value that can be processed by all the layers that successfully transformed the incoming value.
Further, a layer may only fail while it processes an incoming value, and it may only value with the same type as its outgoing value. This guarantees that should a layer fail, it will still produce an outgoing value that can be processed by all the earlier layers that successfully transformed the incoming value.
In a way, the entire design of protocol stacks is geared at ensuring layers that successfully process incoming values will also have a chance to process outgoing values.
The only composition operator on protocol stacks is
++, which simply chains two stacks together. This operator is associative and has an identity (which is the protocol stack that neither transforms incoming nor outgoing values, and which acts as an identity when used to transform handlers). - final case class Proxy(url: URL, credentials: Option[Credentials] = None, headers: Headers = Headers.empty) extends Product with Serializable
Represents the connection to the forward proxy before running the request
- final case class QueryParams(map: Map[String, Chunk[String]]) extends Product with Serializable
A collection of query parameters.
- sealed trait QueryParamsError extends Exception with NoStackTrace
- final case class Request(version: Version = Version.Default, method: Method = Method.ANY, url: URL = URL.empty, headers: Headers = Headers.empty, body: Body = Body.empty, remoteAddress: Option[InetAddress] = None) extends HeaderOps[Request] with Product with Serializable
- type RequestHandler[-R, +Err] = Handler[R, Err, Request, Response]
- final class RequestHandlerInput[A, I] extends AnyRef
- Annotations
- @implicitNotFound()
- final case class Response(status: Status = Status.Ok, headers: Headers = Headers.empty, body: Body = Body.empty) extends HeaderOps[Response] with Product with Serializable
- sealed trait Route[-Env, +Err] extends AnyRef
- abstract class RouteDecode[A] extends AnyRef
- final case class RoutePattern[A](method: Method, pathCodec: PathCodec[A]) extends Product with Serializable
A pattern for matching routes that examines both HTTP method and path.
A pattern for matching routes that examines both HTTP method and path. In addition to specifying a method, patterns contain segment patterns, which are sequences of literals, integers, longs, and other segment types.
Typically, your entry point constructor for a route pattern would be zio.http.Method:
import zio.http.Method import zio.http.codec.SegmentCodec._ val pattern = Method.GET / "users" / int("user-id") / "posts" / string("post-id")
However, you can use the convenience constructors in
RoutePattern, such asRoutePattern.GET. - final class Routes[-Env, +Err] extends AnyRef
Represents a collection of routes, each of which is defined by a pattern and a handler.
Represents a collection of routes, each of which is defined by a pattern and a handler. This data type can be thought of as modeling a routing table, which decides where to direct every endpoint in an API based on both method and path of the request.
When you are done building a collection of routes, you typically convert the routes into an zio.http.HttpApp value, which can be done with the
toHttpAppmethod.Routes may have handled or unhandled errors. A route of type
Route[Env, Throwable], for example, has not handled its errors by converting them into responses. Such unfinished routes cannot yet be converted into zio.http.HttpApp values. First, you must handle errors with thehandleErrororhandleErrorCausemethods. - final case class SSLConfig(behaviour: HttpBehaviour, data: Data, provider: Provider) extends Product with Serializable
- sealed trait Scheme extends AnyRef
- trait Server extends AnyRef
Represents a server, which is capable of serving zero or more HTTP applications.
- final case class ServerSentEvent(data: String, eventType: Option[String] = None, id: Option[String] = None, retry: Option[Int] = None) extends Product with Serializable
Server-Sent Event (SSE) as defined by https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
Server-Sent Event (SSE) as defined by https://html.spec.whatwg.org/multipage/server-sent-events.html#server-sent-events
- data
data, may span multiple lines
- eventType
optional type, must not contain \n or \r
- id
optional id, must not contain \n or \r
- retry
optional reconnection delay in milliseconds
- final case class SocketDecoder(maxFramePayloadLength: Int = 65536, expectMaskedFrames: Boolean = true, allowMaskMismatch: Boolean = false, allowExtensions: Boolean = false, closeOnProtocolViolation: Boolean = true, withUTF8Validator: Boolean = true) extends Product with Serializable
Frame decoder configuration
- sealed trait Status extends Product with Serializable
- final case class StreamingForm(source: ZStream[Any, Throwable, Byte], boundary: Boundary, bufferSize: Int = 8192) extends Product with Serializable
- trait ToHandler[H] extends AnyRef
- Annotations
- @implicitNotFound()
- final case class URL(path: Path, kind: Location = URL.Location.Relative, queryParams: QueryParams = QueryParams.empty, fragment: Option[Fragment] = None) extends Product with Serializable
- trait UrlInterpolator extends AnyRef
- implicit class UrlInterpolatorHelper extends AnyRef
- Definition Classes
- UrlInterpolator
- sealed trait Version extends AnyRef
- final case class WebSocketApp[-R](handler: Handler[R, Throwable, WebSocketChannel, Any], customConfig: Option[WebSocketConfig]) extends Product with Serializable
- type WebSocketChannel = Channel[WebSocketChannelEvent, WebSocketChannelEvent]
A channel that allows websocket frames to be written to it.
- type WebSocketChannelEvent = ChannelEvent[WebSocketFrame]
A channel that allows websocket frames to be read and write to it.
- final case class WebSocketConfig(subprotocols: Option[String] = None, handshakeTimeoutMillis: Long = 10000L, forceCloseTimeoutMillis: Long = -1L, handleCloseFrames: Boolean = true, sendCloseFrame: CloseStatus = WebSocketConfig.CloseStatus.NormalClosure, dropPongFrames: Boolean = true, decoderConfig: SocketDecoder = SocketDecoder.default) extends Product with Serializable
Server side websocket configuration
- sealed trait WebSocketFrame extends Product with Serializable
- final case class ZClient[-Env, -In, +Err, +Out](version: Version, url: URL, headers: Headers, sslConfig: Option[ClientSSLConfig], proxy: Option[Proxy], bodyEncoder: BodyEncoder[Env, Err, In], bodyDecoder: BodyDecoder[Env, Err, Out], driver: ZClient.Driver[Env, Err]) extends HeaderOps[ZClient[Env, In, Err, Out]] with Product with Serializable
- trait ZClientAspect[+LowerEnv, -UpperEnv, +LowerIn, -UpperIn, +LowerErr, -UpperErr, +LowerOut, -UpperOut] extends AnyRef
A
ZClientAspectis capable on modifying some aspect of the execution of a client, such as metrics, tracing, encoding, decoding, or logging. - trait ZCompose[+LeftLower, -LeftUpper, LeftOut[In], +RightLower, -RightUpper, RightOut[In]] extends AnyRef
Value Members
- def Client: ZClient.type
- val Empty: Path
- val Root: Path
- def boolean(name: String): PathCodec[Boolean]
- def handler[H](handler: => H)(implicit h: ToHandler[H]): Handler[Env, Err, In, Out]
A smart constructor that attempts to construct a handler from the specified value.
A smart constructor that attempts to construct a handler from the specified value. If you have difficulty using this function, then please use the constructors on zio.http.Handler directly.
- def handlerTODO(message: String): Handler[Any, Nothing, Any, Nothing]
- def int(name: String): PathCodec[Int]
- def long(name: String): PathCodec[Long]
- def string(name: String): PathCodec[String]
- val trailing: PathCodec[Path]
- def uuid(name: String): PathCodec[UUID]
- object Body
- object Boundary extends Serializable
- object ChannelEvent
- object Charsets
- object ClientDriver
- object ClientSSLConfig
- object ConnectionPoolConfig
- object Cookie
- object Decompression
- object DnsResolver
- object Driver
- object Form extends Serializable
- object FormDecodingError extends Serializable
- object FormField
- object Handler
- object HandlerAspect extends HandlerAspects with Serializable
- object Header
- object Headers
- object HttpApp extends Serializable
- object MediaType extends MediaTypes with Serializable
- object Method
- object Middleware extends HandlerAspects
- object Path extends Serializable
- object ProtocolStack
- object Proxy extends Serializable
- object QueryParams extends Serializable
- object QueryParamsError extends Serializable
- object Request extends Serializable
- object RequestHandlerInput
- object Response extends Serializable
- object Route
- object RoutePattern extends Serializable
- object Routes
- object SSLConfig extends Serializable
- object Scheme
- object Server
- object ServerSentEvent extends Serializable
- object SocketDecoder extends Serializable
- object Status extends Serializable
- object StreamingForm extends Serializable
- object ToHandler extends HandlerConstructorLowPriorityImplicits0
- object URL extends Serializable
- object Version
- object WebSocketApp extends Serializable
- object WebSocketConfig extends Serializable
- object WebSocketFrame extends Serializable
- object ZClient extends Serializable
- object ZClientAspect
- object ZCompose extends ComposeLowPriorityImplicits