http.response
Returns an empty/default response for an http handler. i.e.
┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄ header status body ┌───┬─────┬───┐ 200 │ k │ seq │ v │ ├───┼─────┼───┤ └───┴─────┴───┘ ┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄
This can be used as a starting point for route relgen responses.
Examples
route relgen handler
import("http")
index_handler := {attr_types(http.response)} begin
response := http.response{*, body := "Hello world, wide web"}
yield
end
route relgen handler with headers
import("http")
login_handler := {attr_types(http.response)} begin
sid:="todo get session id"
// etc.
response := http.response{*,
status:=303,
header:={k:str, v:str, seq:int}{
["Location", "/", 0],
["Set-Cookie", sprint("session_id=«sid»; SameSite=Strict; HttpOnly"), 1]
}
}
yield
end