Http

object Http
Companion:
class
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Http.type

Type members

Classlikes

final implicit class HttpAppSyntax[-R, +E](val http: HttpApp[R, E]) extends HeaderModifierZIO[HttpApp[R, E]]
final case class PartialCollect[A](unit: Unit) extends AnyVal
final case class PartialCollectHExit[A](unit: Unit) extends AnyVal
final case class PartialCollectHttp[A](unit: Unit) extends AnyVal
final case class PartialCollectZIO[A](unit: Unit) extends AnyVal
final case class PartialContraFlatMap[-R, +E, -A, +B, X](self: Http[R, E, A, B]) extends AnyVal
final class PartialFromFunction[A](val unit: Unit) extends AnyVal
final class PartialFromFunctionHExit[A](val unit: Unit) extends AnyVal
final class PartialFromFunctionZIO[A](val unit: Unit) extends AnyVal
final class PartialFromOptionFunction[A](val unit: Unit) extends AnyVal

Inherited types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Inherited from:
Mirror

The name of the type

The name of the type

Inherited from:
Mirror

Value members

Concrete methods

def apply[B](b: B): Http[Any, Nothing, Any, B]

Equivalent to Http.succeed

Equivalent to Http.succeed

def attempt[A](a: => A): Http[Any, Throwable, Any, A]

Attempts to create an Http that succeeds with the provided value, capturing all exceptions on it's way.

Attempts to create an Http that succeeds with the provided value, capturing all exceptions on it's way.

def badRequest(msg: String): HttpApp[Any, Nothing]

Creates an HTTP app which always responds with a 400 status code.

Creates an HTTP app which always responds with a 400 status code.

Creates an HTTP app which accepts a request and produces response.

Creates an HTTP app which accepts a request and produces response.

Create an HTTP app from a partial function from A to HExit[R,E,B]

Create an HTTP app from a partial function from A to HExit[R,E,B]

Create an HTTP app from a partial function from A to Http[R,E,A,B]

Create an HTTP app from a partial function from A to Http[R,E,A,B]

Creates an HTTP app which accepts a request and produces response effectfully.

Creates an HTTP app which accepts a request and produces response effectfully.

def combine[R, E, A, B](i: Iterable[Http[R, E, A, B]]): Http[R, E, A, B]

Combines multiple Http apps into one

Combines multiple Http apps into one

def die(t: Throwable): UHttp[Any, Nothing]

Returns an http app that dies with the specified Throwable. This method can be used for terminating an app because a defect has been detected in the code. Terminating an http app leads to aborting handling of an HTTP request and responding with 500 Internal Server Error.

Returns an http app that dies with the specified Throwable. This method can be used for terminating an app because a defect has been detected in the code. Terminating an http app leads to aborting handling of an HTTP request and responding with 500 Internal Server Error.

def dieMessage(message: => String): UHttp[Any, Nothing]

Returns an app that dies with a RuntimeException having the specified text message. This method can be used for terminating a HTTP request because a defect has been detected in the code.

Returns an app that dies with a RuntimeException having the specified text message. This method can be used for terminating a HTTP request because a defect has been detected in the code.

def empty: Http[Any, Nothing, Any, Nothing]

Creates an empty Http value

Creates an empty Http value

def error(cause: HttpError): HttpApp[Any, Nothing]

Creates an HTTP app with HttpError.

Creates an HTTP app with HttpError.

def error(msg: String): HttpApp[Any, Nothing]

Creates an Http app that responds with 500 status code

Creates an Http app that responds with 500 status code

def fail[E](e: E): Http[Any, E, Any, Nothing]

Creates an Http that always fails

Creates an Http that always fails

def failCause[E](cause: Cause[E]): Http[Any, E, Any, Nothing]
def flatten[R, E, A, B](http: Http[R, E, A, Http[R, E, A, B]]): Http[R, E, A, B]

Flattens an Http app of an Http app

Flattens an Http app of an Http app

def flattenZIO[R, E, A, B](http: Http[R, E, A, ZIO[R, E, B]])(implicit trace: Trace): Http[R, E, A, B]

Flattens an Http app of an that returns an effectful response

Flattens an Http app of an that returns an effectful response

def forbidden(msg: String): HttpApp[Any, Nothing]

Creates an Http app that responds with 403 - Forbidden status code

Creates an Http app that responds with 403 - Forbidden status code

def fromBody(body: Body): HttpApp[Any, Nothing]

Creates an Http app which always responds the provided data and a 200 status code

Creates an Http app which always responds the provided data and a 200 status code

def fromEither[E, A](v: Either[E, A]): Http[Any, E, Any, A]

Lifts an Either into a Http value.

Lifts an Either into a Http value.

def fromFile(file: => File)(implicit trace: Trace): HttpApp[Any, Throwable]

Creates an Http app from the contents of a file.

Creates an Http app from the contents of a file.

def fromFileZIO[R](fileZIO: ZIO[R, Throwable, File])(implicit trace: Trace): HttpApp[R, Throwable]

Creates an Http app from the contents of a file which is produced from an effect. The operator automatically adds the content-length and content-type headers if possible.

Creates an Http app from the contents of a file which is produced from an effect. The operator automatically adds the content-length and content-type headers if possible.

Creates a Http from a pure function

Creates a Http from a pure function

Creates a Http from an pure function from A to HExit[R,E,B]

Creates a Http from an pure function from A to HExit[R,E,B]

Creates a Http from an effectful pure function

Creates a Http from an effectful pure function

def fromHExit[R, E, B](h: HExit[R, E, B]): Http[R, E, Any, B]

Creates a Http from HExit[R,E,B]

Creates a Http from HExit[R,E,B]

def fromOption[A](v: Option[A]): Http[Any, Option[Nothing], Any, A]

Lifts an Option into a Http value.

Lifts an Option into a Http value.

Creates an Http from a function that takes a value of type A and returns with a ZIO[R, Option[E], B]. The returned effect can fail with a None to signal "not found" to the backend.

Creates an Http from a function that takes a value of type A and returns with a ZIO[R, Option[E], B]. The returned effect can fail with a None to signal "not found" to the backend.

def fromPath(head: String, tail: String*)(implicit trace: Trace): HttpApp[Any, Throwable]

Creates an HTTP that can serve files on the give path.

Creates an HTTP that can serve files on the give path.

def fromResource(path: String)(implicit trace: Trace): HttpApp[Any, Throwable]

Creates an Http app from a resource path

Creates an Http app from a resource path

def fromStream[R](stream: ZStream[R, Throwable, String], charset: Charset)(implicit trace: Trace): HttpApp[R, Nothing]

Creates a Http that always succeeds with a 200 status code and the provided ZStream as the body

Creates a Http that always succeeds with a 200 status code and the provided ZStream as the body

def fromStream[R](stream: ZStream[R, Throwable, Byte])(implicit trace: Trace): HttpApp[R, Nothing]

Creates a Http that always succeeds with a 200 status code and the provided ZStream as the body

Creates a Http that always succeeds with a 200 status code and the provided ZStream as the body

def fromZIO[R, E, B](effect: ZIO[R, E, B])(implicit trace: Trace): Http[R, E, Any, B]

Converts a ZIO to an Http type

Converts a ZIO to an Http type

def getResource(path: String)(implicit trace: Trace): Http[Any, Throwable, Any, URL]

Attempts to retrieve files from the classpath.

Attempts to retrieve files from the classpath.

def getResourceAsFile(path: String)(implicit trace: Trace): Http[Any, Throwable, Any, File]

Attempts to retrieve files from the classpath.

Attempts to retrieve files from the classpath.

def html(view: Html): HttpApp[Any, Nothing]

Creates an HTTP app which always responds with the provided Html page.

Creates an HTTP app which always responds with the provided Html page.

def identity[A]: Http[Any, Nothing, A, A]

Creates a pass thru Http instance

Creates a pass thru Http instance

def methodNotAllowed(msg: String): HttpApp[Any, Nothing]

Creates an HTTP app which always responds with a 405 status code.

Creates an HTTP app which always responds with a 405 status code.

def notFound: HttpApp[Any, Nothing]

Creates an Http app that fails with a NotFound exception.

Creates an Http app that fails with a NotFound exception.

def ok: HttpApp[Any, Nothing]

Creates an HTTP app which always responds with a 200 status code.

Creates an HTTP app which always responds with a 200 status code.

def response(response: Response): Http[Any, Nothing, Any, Response]

Creates an Http app which always responds with the same value.

Creates an Http app which always responds with the same value.

def responseZIO[R, E](res: ZIO[R, E, Response])(implicit trace: Trace): HttpApp[R, E]

Converts a ZIO to an Http app type

Converts a ZIO to an Http app type

def stackTrace(implicit trace: Trace): Http[Any, Nothing, Any, StackTrace]
def status(code: Status): HttpApp[Any, Nothing]

Creates an HTTP app which always responds with the same status code and empty data.

Creates an HTTP app which always responds with the same status code and empty data.

def succeed[B](b: B): Http[Any, Nothing, Any, B]

Creates an Http that always returns the same response and never fails.

Creates an Http that always returns the same response and never fails.

def template(heading: CharSequence)(view: Html): HttpApp[Any, Nothing]

Creates an Http app which responds with an Html page using the built-in template.

Creates an Http app which responds with an Html page using the built-in template.

def text(charSeq: CharSequence): HttpApp[Any, Nothing]

Creates an Http app which always responds with the same plain text.

Creates an Http app which always responds with the same plain text.

def timeout(duration: Duration)(implicit trace: Trace): HttpApp[Any, Nothing]

Creates an Http app that responds with a 408 status code after the provided time duration

Creates an Http app that responds with a 408 status code after the provided time duration

def tooLarge: HttpApp[Any, Nothing]

Creates an HTTP app which always responds with a 413 status code.

Creates an HTTP app which always responds with a 413 status code.

Implicits

Implicits

final implicit def HttpAppSyntax[R, E](http: HttpApp[R, E]): HttpAppSyntax[R, E]