aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/source')
-rw-r--r--stdlib/source/lux/world/net/http/header.lux18
1 files changed, 15 insertions, 3 deletions
diff --git a/stdlib/source/lux/world/net/http/header.lux b/stdlib/source/lux/world/net/http/header.lux
index a5dd66748..3a96b37fa 100644
--- a/stdlib/source/lux/world/net/http/header.lux
+++ b/stdlib/source/lux/world/net/http/header.lux
@@ -1,5 +1,7 @@
(.module:
[lux #*
+ [control
+ [pipe (#+ case>)]]
[data
[text
format]
@@ -9,14 +11,24 @@
["." 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)
- (|>> %n (dictionary.put "Content-Length")))
+ (|>> %n (..add "Content-Length")))
(def: #export content-type
(-> MIME Header)
- (|>> mime.name (dictionary.put "Content-Type")))
+ (|>> mime.name (..add "Content-Type")))
(def: #export location
(-> URL Header)
- (dictionary.put "Location"))
+ (..add "Location"))