thruster-rs / Thruster

A fast, middleware based, web framework written in Rust
MIT License
1.06k stars 47 forks source link

[FEATURE REQUEST] Easier access to read request headers #228

Closed Israel-Laguan closed 1 year ago

Israel-Laguan commented 1 year ago

The current way to check headers is in the line of

let header = context
  .hyper_request
  .as_ref()
  .unwrap()
  .request
  .headers()
  .get("Origin");

Which for a commonly used section of the request feels long.

An easier way to read the headers (like the context.content_type("application/json"); to set a custom outbound header) would lower the entrance bar for new people trying thruster for use as a server.

Request

trezm commented 1 year ago

Please see #232 for examples!

Israel-Laguan commented 1 year ago

Solved in https://github.com/thruster-rs/Thruster/pull/232

Israel-Laguan commented 1 year ago

Can this be closed?