On this page:
payload.Function
payload.buffered
payload.form
payload.json
payload.gzip
payload.pure
payload.multipart.Part
payload.multipart
payload.multipart.Part.field
payload.multipart.Part.file
payload.multipart.Part.handle
0.45+9.1

5 Payload Data🔗ℹ

annotation

http.payload.Function

Equivalent to

(Headers)

  -> values(Headers, Bytes || String || Port.Input)

representing a function to generate a payload for Session.request.

Produces a payload function that buffers the result of f in memory to determine its length before sending it to the server.

Produces a payload function that encodes v as form data using the application/x-www-form-urlencoded content type.

function

fun http.payload.json(v :: json.JSON) :: payload.Function

Produces a payload function that encodes v as JSON data.

Produces a payload function that gzips the output of f.

Produces a payload function that uses inp as the request body.

class

class http.payload.multipart.Part():

  constructor ~none

 

function

fun http.payload.multipart(

  ~boundary: boundary :: maybe(Bytes || String),

  f :: payload.multipart.Part, ...

) :: payload.Function

A payload.multipart.Part can be used with payload.multipart to produce a multipart/form-data payload.

function

fun http.payload.multipart.Part.field(

  ~name: name :: Bytes || String,

  ~value: value :: Bytes || String,

  ~content_type: content_type :: Bytes || String = #"text/plain"

) :: payload.multipart.Part

Produces a payload.multipart.Part that encapsulates a form field.

function

fun http.payload.multipart.Part.file(

  ~name: name :: Bytes || String,

  ~in: inp :: Port.Input,

  ~filename: filename :: Bytes || String = to_string(inp.name()),

  ~content_type: content_type :: Bytes || String = #"application/octet-stream"

) :: payload.multipart.Part

Produces a payload.multipart.Part that encapsulates a file.

Returns a Racket representation of the part.