Skip to content
scalive
Menu
ConnectingLiveReconnectingOffline
GitHub
c

HttpFormDecoder

class HttpFormDecoder[A]

Bounded decoder for CSRF-protected, URL-encoded ordinary HTTP forms.

Body bounds and representation checks run before CSRF validation, which runs before semantic decoding. Rejections are typed as Error and map to conservative responses.

Defined by scalive.HttpFormDecoder. View source (scalive/transport/zio-http/src/scalive/HttpFormDecoder.scala:11-52)

Methods2

decode

def decode(request: zio.http.Request): zio.package.IO[HttpFormDecoder.Error, A]

Enforces maxBytes, validates URL-encoded representation and CSRF, then decodes.

Defined by scalive.HttpFormDecoder.decode. View source (scalive/transport/zio-http/src/scalive/HttpFormDecoder.scala:17-27)

respond

def respond[R, E](request: zio.http.Request, onValidation: FormErrors[?] => zio.ZIO[R, E, zio.http.Response], onRejected: HttpFormDecoder.Error => zio.package.URIO[R, Unit] = ...)(onDecoded: A => zio.ZIO[R, E, zio.http.Response]): zio.ZIO[R, E, zio.http.Response]

Decodes and produces an HTTP response with centralized rejection handling.

onRejected observes every decoder rejection but cannot replace its security-sensitive status. It runs before any rejection response callback. onValidation is lazy and runs only for semantic validation; its environment and typed failures remain part of the returned effect rather than becoming decoder rejections. Successful decoding is passed unchanged to onDecoded. An observer defect or interruption aborts response production; no fallback response is substituted.

Defined by scalive.HttpFormDecoder.respond. View source (scalive/transport/zio-http/src/scalive/HttpFormDecoder.scala:38-51)