Module

Yoga.HTTP.API.Route.Encoding

Package
purescript-yoga-http-api
Repository
rowtype-yoga/purescript-yoga-http-api

#JSON Source

data JSON a

JSON-encoded request body (application/json)

Example: Request { body :: JSON User }

#FormData Source

data FormData a

Form data encoded request body (application/x-www-form-urlencoded)

Example: Request { body :: FormData { username :: String, password :: String } }

#MultipartFormData Source

data MultipartFormData a

Multipart form data encoded request body (multipart/form-data)

Example: Request { body :: MultipartFormData { file :: FileUpload } }

#MultipartFile Source

data MultipartFile

Opaque bytes for a file field produced by a multipart parser. The type prevents ordinary text fields and uploaded bytes being confused.

Instances

#multipartFileBytes Source

multipartFileBytes :: MultipartFile -> Uint8Array

Access uploaded bytes without copying.

#PlainText Source

data PlainText

Plain text request/response body (text/plain)

Example: { body :: PlainText }

#XML Source

data XML a

XML encoded request/response body (application/xml)

Example: Request { body :: XML XmlDocument }

#CustomContentType Source

data CustomContentType :: Symbol -> Type -> Typedata CustomContentType mime a

Custom content type with explicit MIME type

Example: Request { body :: CustomContentType "application/vnd.api+json" User }

#Streaming Source

data Streaming t0

A standards-based Web ReadableStream used as an HTTP response body. pull is called only when the consumer requests another chunk. Returning Nothing closes the stream; disconnecting the consumer runs cancel.

Instances

#StreamChunk Source

data StreamChunk

A chunk representation accepted by Node and Web byte streams.

#textChunk Source

textChunk :: String -> StreamChunk

Construct a textual stream chunk.

#binaryChunk Source

binaryChunk :: Uint8Array -> StreamChunk

Construct a binary stream chunk without copying its Uint8Array.

#streaming Source

#NoBody Source

data NoBody

No request body (for GET, DELETE, etc.)

Example: Request {} -- NoBody is the default when body is omitted