AlexCouch / pluvo

Pluvo is a modern web framework purely in Gleam built ontop of mist
4 stars 0 forks source link

Complete `context` module functions for request/response modification #7

Closed AlexCouch closed 10 months ago

AlexCouch commented 10 months ago

Description

The context module needs to be easily modified so that middleware can add/read headers, modify the body, and anything else they need to do, and to allow route handlers to get cookies and query parameters.

Example

pub fn handler(ctx: Context) -> Response{
  let cookie = ctx
  |> context.get_cookie(cookie_name)

  let header_value = ctx
  |> context.get_header(header_name)

  let query_param = ctx
  |> context.get_query_param(query_name)

  ...
}
AlexCouch commented 10 months ago

Cookies are done now as of 4c79c1a

AlexCouch commented 10 months ago

get/set headers have also been done. Also, I didn't mean to close the issue.

AlexCouch commented 10 months ago

Added get_query_param in context as of 4847479