File tree 9 files changed +37
-19
lines changed
9 files changed +37
-19
lines changed Original file line number Diff line number Diff line change 31
31
*---------------------------------------------------------------------------*)
32
32
33
33
open Lwt.Infix
34
+ module Piaf = Piaf_lwt
34
35
35
36
module Constants = struct
36
37
let runtime_api_version = " 2018-06-01"
Original file line number Diff line number Diff line change 3
3
(public_name lambda-runtime)
4
4
(preprocess
5
5
(pps ppx_deriving_yojson))
6
- (libraries yojson ppx_deriving_yojson.runtime bigstringaf bigarray-compat
7
- uri logs.lwt lwt lwt.unix piaf result))
6
+ (libraries
7
+ yojson
8
+ ppx_deriving_yojson.runtime
9
+ bigstringaf
10
+ bigarray-compat
11
+ uri
12
+ logs.lwt
13
+ lwt
14
+ lwt.unix
15
+ piaf-lwt
16
+ result))
Original file line number Diff line number Diff line change 31
31
*---------------------------------------------------------------------------*)
32
32
33
33
open Lwt.Infix
34
+ module Piaf = Piaf_lwt
34
35
35
36
module Make
36
37
(Event : Runtime_intf.LambdaEvent )
Original file line number Diff line number Diff line change 1
1
(library
2
2
(public_name vercel)
3
- (libraries bigstringaf lwt lambda-runtime yojson ppx_deriving_yojson.runtime
4
- result base64 piaf)
3
+ (libraries
4
+ bigstringaf
5
+ lwt
6
+ lambda-runtime
7
+ yojson
8
+ ppx_deriving_yojson.runtime
9
+ result
10
+ base64
11
+ piaf-lwt)
5
12
(preprocess
6
13
(pps ppx_deriving_yojson)))
Original file line number Diff line number Diff line change 31
31
*---------------------------------------------------------------------------*)
32
32
33
33
module StringMap = Lambda_runtime. StringMap
34
- module Headers = Piaf .Headers
34
+ module Headers = Piaf_lwt .Headers
35
35
36
36
let decode_body ~encoding body =
37
37
match body, encoding with
Original file line number Diff line number Diff line change 31
31
*---------------------------------------------------------------------------*)
32
32
33
33
module StringMap = Lambda_runtime. StringMap
34
- module Request = Piaf .Request
35
- module Body = Piaf .Body
36
- module Headers = Piaf .Headers
34
+ module Request = Piaf_lwt .Request
35
+ module Body = Piaf_lwt .Body
36
+ module Headers = Piaf_lwt .Headers
37
37
38
38
type vercel_proxy_request =
39
39
{ path : string
@@ -60,7 +60,7 @@ let of_yojson json =
60
60
Yojson.Safe. from_string event_body |> vercel_proxy_request_of_yojson
61
61
with
62
62
| Ok { body; encoding; path; http_method; host; headers } ->
63
- let meth = Piaf .Method. of_string http_method in
63
+ let meth = Piaf_lwt .Method. of_string http_method in
64
64
let headers =
65
65
Message. string_map_to_headers
66
66
~init:
@@ -83,7 +83,7 @@ let of_yojson json =
83
83
let request =
84
84
Request. create
85
85
~scheme: HTTP
86
- ~version: Piaf .Versions.HTTP. v1_1
86
+ ~version: Piaf_lwt .Versions.HTTP. v1_1
87
87
~headers
88
88
~meth
89
89
~body
Original file line number Diff line number Diff line change 31
31
*---------------------------------------------------------------------------*)
32
32
33
33
module StringMap = Lambda_runtime. StringMap
34
- module Response = Piaf .Response
34
+ module Response = Piaf_lwt .Response
35
35
36
36
type vercel_proxy_response =
37
37
{ status_code : int [@ key "statusCode" ]
@@ -48,11 +48,11 @@ let to_yojson { Response.status; headers; body; _ } =
48
48
(fun body ->
49
49
let body = Result. get_ok body in
50
50
let vercel_proxy_response =
51
- { status_code = Piaf .Status. to_code status
51
+ { status_code = Piaf_lwt .Status. to_code status
52
52
; headers = Message. headers_to_string_map headers
53
53
; body
54
54
; encoding = None
55
55
}
56
56
in
57
57
vercel_proxy_response_to_yojson vercel_proxy_response)
58
- (Piaf .Body. to_string body)
58
+ (Piaf_lwt .Body. to_string body)
Original file line number Diff line number Diff line change 33
33
include Lambda_runtime. Make (Request ) (Response )
34
34
35
35
(* Proxy to Piaf for Headers, Request and Response for convenience *)
36
- module Headers = Piaf .Headers
37
- module Request = Piaf .Request
38
- module Response = Piaf .Response
36
+ module Headers = Piaf_lwt .Headers
37
+ module Request = Piaf_lwt .Request
38
+ module Response = Piaf_lwt .Response
Original file line number Diff line number Diff line change @@ -35,15 +35,15 @@ open Lambda_runtime
35
35
(* To keep module equality. See e.g.:
36
36
* https://stackoverflow.com/a/37307124/3417023 *)
37
37
module Headers : module type of struct
38
- include Piaf .Headers
38
+ include Piaf_lwt .Headers
39
39
end
40
40
41
41
module Request : module type of struct
42
- include Piaf .Request
42
+ include Piaf_lwt .Request
43
43
end
44
44
45
45
module Response : module type of struct
46
- include Piaf .Response
46
+ include Piaf_lwt .Response
47
47
end
48
48
49
49
include
You can’t perform that action at this time.
0 commit comments