blob: 6f8d92cc2204299fca8ef2f735bc96f632eeef82 (
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: .public (add name value)
(-> Text Text Header)
(dictionary.upsert name ""
(|>> (case>
""
value
previous
(format previous "," value)))))
(def: .public content_length
(-> Nat Header)
(|>> %.nat (..add "Content-Length")))
(def: .public content_type
(-> MIME Header)
(|>> mime.name (..add "Content-Type")))
(def: .public location
(-> URL Header)
(..add "Location"))
|