ogre/operation

Types

pub type Operation(t) {
  Operation(
    method: http.Method,
    path: String,
    query: option.Option(String),
    headers: List(#(String, String)),
    body: t,
  )
}

Constructors

  • Operation(
      method: http.Method,
      path: String,
      query: option.Option(String),
      headers: List(#(String, String)),
      body: t,
    )

Values

pub fn get(path: String) -> Operation(BitArray)
pub fn post(path: String) -> Operation(BitArray)
pub fn set_body(
  req: Operation(old_body),
  body: new_body,
) -> Operation(new_body)

Set the body of the request, overwriting any existing body.

pub fn set_header(
  operation: Operation(body),
  key: String,
  value: String,
) -> Operation(body)

Set the header with the given value under the given header key.

If already present, it is replaced.

Header keys are always lowercase in gleam_http. To use any uppercase letter is invalid.

pub fn set_query(
  operation: Operation(body),
  query: List(#(String, String)),
) -> Operation(body)

Set the query of the request. Query params will be percent encoded before being added to the Request.

pub fn to_request(
  operation: Operation(t),
  origin: origin.Origin,
) -> request.Request(t)
Search Document