Skip to content

Commit 2870994

Browse files
update HTTP with uppercase tags, copied from basic-webserver
1 parent edb704a commit 2870994

File tree

3 files changed

+24
-24
lines changed

3 files changed

+24
-24
lines changed

examples/http-get.roc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ main! = \_args ->
1010

1111
response = Http.send!(
1212
{
13-
method: Get,
13+
method: GET,
1414
headers: [],
1515
uri: "http://www.example.com",
1616
body: [],

platform/Http.roc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Response : InternalHttp.Response
3636
##
3737
default_request : Request
3838
default_request = {
39-
method: Get,
39+
method: GET,
4040
headers: [],
4141
uri: "",
4242
body: [],

platform/InternalHttp.roc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ module [
1919
# FOR ROC
2020

2121
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods
22-
Method : [Options, Get, Post, Put, Delete, Head, Trace, Connect, Patch, Extension Str]
22+
Method : [OPTIONS, GET, POST, PUT, DELETE, HEAD, TRACE, CONNECT, PATCH, EXTENSION Str]
2323

2424
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers
2525
Header : { name : Str, value : Str }
@@ -75,21 +75,21 @@ to_host_request = \{ method, headers, uri, body, timeout_ms } -> {
7575
to_host_method : Method -> _
7676
to_host_method = \method ->
7777
when method is
78-
Options -> 5
79-
Get -> 3
80-
Post -> 7
81-
Put -> 8
82-
Delete -> 1
83-
Head -> 4
84-
Trace -> 9
85-
Connect -> 0
86-
Patch -> 6
87-
Extension(_) -> 2
78+
OPTIONS -> 5
79+
GET -> 3
80+
POST -> 7
81+
PUT -> 8
82+
DELETE -> 1
83+
HEAD -> 4
84+
TRACE -> 9
85+
CONNECT -> 0
86+
PATCH -> 6
87+
EXTENSION(_) -> 2
8888

8989
to_host_method_ext : Method -> Str
9090
to_host_method_ext = \method ->
9191
when method is
92-
Extension(ext) -> ext
92+
EXTENSION(ext) -> ext
9393
_ -> ""
9494

9595
to_host_timeout : _ -> U64
@@ -110,16 +110,16 @@ from_host_request = \{ method, method_ext, headers, uri, body, timeout_ms } -> {
110110
from_host_method : U64, Str -> Method
111111
from_host_method = \tag, ext ->
112112
when tag is
113-
5 -> Options
114-
3 -> Get
115-
7 -> Post
116-
8 -> Put
117-
1 -> Delete
118-
4 -> Head
119-
9 -> Trace
120-
0 -> Connect
121-
6 -> Patch
122-
2 -> Extension(ext)
113+
5 -> OPTIONS
114+
3 -> GET
115+
7 -> POST
116+
8 -> PUT
117+
1 -> DELETE
118+
4 -> HEAD
119+
9 -> TRACE
120+
0 -> CONNECT
121+
6 -> PATCH
122+
2 -> EXTENSION(ext)
123123
_ -> crash("invalid tag from host")
124124

125125
from_host_timeout : U64 -> [TimeoutMilliseconds U64, NoTimeout]

0 commit comments

Comments
 (0)