Skip to content

Commit e2ff83e

Browse files
committed
sync with new updates on main branch
1 parent 1a7f60a commit e2ff83e

File tree

3 files changed

+9
-20
lines changed

3 files changed

+9
-20
lines changed

README.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,9 @@ let streaming_handler req =
107107
Response.make ~body:(Body.of_stream ?length body) () |> Lwt.return
108108
;;
109109
110-
let print_param_handler req =
111-
Printf.sprintf "Hello, %s\n" (Router.param req "name")
112-
|> Response.of_plain_text
113-
|> Lwt.return
114-
;;
115-
116110
let _ =
117111
App.empty
118112
|> App.post "/hello/stream" streaming_handler
119-
|> App.get "/hello/:name" print_param_handler
120113
|> App.get "/person/:name/:age" print_person_handler
121114
|> App.patch "/person" update_person_handler
122115
|> App.run_command

example/hello_world/main.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,9 @@ let streaming_handler req =
3737
Response.make ~body:(Body.of_stream ?length body) () |> Lwt.return
3838
;;
3939

40-
let print_param_handler req =
41-
Printf.sprintf "Hello, %s\n" (Router.param req "name")
42-
|> Response.of_plain_text
43-
|> Lwt.return
44-
;;
45-
4640
let _ =
4741
App.empty
4842
|> App.post "/hello/stream" streaming_handler
49-
|> App.get "/hello/:name" print_param_handler
5043
|> App.get "/person/:name/:age" print_person_handler
5144
|> App.patch "/person" update_person_handler
5245
|> App.run_command

opium/test/opium_router_tests.ml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ let%expect_test "we can extract parameter after match" =
8484
test_match_url router "/foo/100/baz";
8585
test_match_url router "/foo/100";
8686
test_match_url router "/foo/100/200/300";
87-
[%expect {|
87+
[%expect
88+
{|
8889
matched with params: ((named ((bar baz))) (unnamed (100)) (full_splat ()))
8990
no match
9091
no match |}]
@@ -143,8 +144,7 @@ let%expect_test "nodes are matched correctly" =
143144
let test = test_match router in
144145
test "/foo/bar" "Wrong";
145146
test "/foo/baz" "Right";
146-
[%expect
147-
{| |}]
147+
[%expect {| |}]
148148
;;
149149
150150
let%expect_test "full splat node matches" =
@@ -153,7 +153,8 @@ let%expect_test "full splat node matches" =
153153
test "/foo/bar";
154154
test "/foo/bar/foo";
155155
test "/foo/";
156-
[%expect {|
156+
[%expect
157+
{|
157158
matched with params: ((named ()) (unnamed ()) (full_splat (bar)))
158159
matched with params: ((named ()) (unnamed ()) (full_splat (bar/foo)))
159160
matched with params: ((named ()) (unnamed ()) (full_splat ())) |}]
@@ -179,7 +180,8 @@ let%expect_test "two parameters" =
179180
let router = of_routes' [ "/test/:format/:name/:baz" ] in
180181
let test = test_match_url router in
181182
test "/test/json/bar/blah";
182-
[%expect {|
183+
[%expect
184+
{|
183185
matched with params: ((named ((baz blah) (name bar) (format json)))
184186
(unnamed ()) (full_splat ())) |}]
185187
;;
@@ -192,7 +194,8 @@ let%expect_test "full splat" =
192194
test "/";
193195
test "";
194196
test "/user/123/foo/bar";
195-
[%expect{|
197+
[%expect
198+
{|
196199
matched with params: ((named ()) (unnamed ()) (full_splat (test)))
197200
matched with params: ((named ()) (unnamed ()) (full_splat (test/)))
198201
matched with params: ((named ()) (unnamed ()) (full_splat ()))

0 commit comments

Comments
 (0)