blob: e5b1882adfbc384ed2431a26d91e0f3aa545c489 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
(.module:
[library
[lux #*
[control
[pipe (#+ case>)]]
[data
[text
["%" format (#+ format)]]
[collection
["." dictionary (#+ Dictionary)]]]]]
[// (#+ Header)
["." mime (#+ MIME)]
[// (#+ URL)]])
(def: #export (add name value)
(-> Text Text Header)
(dictionary.upsert name ""
(|>> (case>
""
value
previous
(format previous "," value)))))
(def: #export content-length
(-> Nat Header)
(|>> %.nat (..add "Content-Length")))
(def: #export content-type
(-> MIME Header)
(|>> mime.name (..add "Content-Type")))
(def: #export location
(-> URL Header)
(..add "Location"))
|