aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/lux/world/net/http.lux
blob: 6682c24bd94799dead9b745f228cb02c8c3a46d9 (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
(.module:
  [lux #*
   [control
    [try (#+ Try)]
    [concurrency
     [promise (#+ Promise)]
     [frp (#+ Channel)]]
    [parser
     ["." environment (#+ Environment)]]]
   [data
    [binary (#+ Binary)]]]
  [// (#+ URL)
   [uri (#+ URI)]])

(type: #export Version
  Text)

(type: #export Method
  #Post
  #Get
  #Put
  #Patch
  #Delete
  #Head
  #Connect
  #Options
  #Trace)

(type: #export Port
  Nat)

(type: #export Status
  Nat)

(type: #export Headers
  Environment)

(def: #export empty
  Headers
  environment.empty)

(type: #export Header
  (-> Headers Headers))

(type: #export (Body !)
  (-> (Maybe Nat) (! (Try [Nat Binary]))))

(type: #export Scheme
  #HTTP
  #HTTPS)

(type: #export Address
  {#port Port
   #host Text})

(type: #export Identification
  {#local  Address
   #remote Address})

(type: #export Protocol
  {#version Version
   #scheme  Scheme})

(type: #export Resource
  {#method Method
   #uri    URI})

(type: #export (Message !)
  {#headers Headers
   #body    (Body !)})

(type: #export (Request !)
  [Identification Protocol Resource (Message !)])

(type: #export (Response !)
  [Status (Message !)])

(type: #export (Server !)
  (-> (Request !) (! (Response !))))