object BodyCache
Middleware for caching the request body for multiple compilations
As the body of the request is the fs2.Stream of bytes, compiling it several times (e.g. with middlewares) is unsafe. This middleware forbids such behaviour, compiling the body only once. It does so only for the "inner" middlewares:
val route = AMiddleware(BodyCache(SomeOtherMiddleware(myRoute)))
In this example only myRoute
& SomeOtherMiddleware
will receive cached request body,
while the AMiddleware
will get the raw one.
As the entire request body will be allocated in memory,
there is a possibility of OOM error with a large body.
Because of that, using the EntityLimiter
middleware is strongly advised.
- Source
- BodyCache.scala
- Note
This middleware has nothing to do with the HTTP caching mechanism and it does not cache bodies between multiple requests.
Linear Supertypes
Ordering
- Alphabetic
- By Inheritance
Inherited
- BodyCache
- AnyRef
- Any
- Hide All
- Show All
Visibility
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def apply[G[_], F[_], R](old: Kleisli[G, R, Response[F]])(reqGet: (R) => Request[F], reqSet: (R) => (Request[F]) => R)(lift: ~>[F, G])(implicit arg0: Concurrent[G], arg1: Concurrent[F]): Kleisli[G, R, Response[F]]
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def contextRoutes[T, F[_]](routes: ContextRoutes[T, F])(implicit arg0: Concurrent[F]): ContextRoutes[T, F]
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hasNoBody[F[_]](req: Request[F]): Boolean
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def httpApp[F[_]](app: HttpApp[F])(implicit arg0: Concurrent[F]): HttpApp[F]
- def httpRoutes[F[_]](routes: HttpRoutes[F])(implicit arg0: Concurrent[F]): HttpRoutes[F]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()