refactor: pipe directly response into adding security headers

This commit is contained in:
2026-03-01 22:09:26 +01:00
parent cb9c9369ba
commit a23498a0ca

View File

@@ -20,12 +20,12 @@ pub fn handle(
storage: process.Subject(storage.StorageMsg), storage: process.Subject(storage.StorageMsg),
_secret_key_base: String, _secret_key_base: String,
) -> wisp.Response { ) -> wisp.Response {
let response = case wisp.path_segments(request) { case wisp.path_segments(request) {
[] -> handle_home(request, storage) [] -> handle_home(request, storage)
["paste", key_param] -> handle_paste(request, storage, key_param) ["paste", key_param] -> handle_paste(request, storage, key_param)
_ -> wisp.not_found() _ -> wisp.not_found()
} }
add_security_headers(response) |> add_security_headers
} }
fn add_security_headers(response: wisp.Response) -> wisp.Response { fn add_security_headers(response: wisp.Response) -> wisp.Response {