Skip to content

Commit

Permalink
run ocamlformat
Browse files Browse the repository at this point in the history
Signed-off-by: Marcello Seri <[email protected]>
  • Loading branch information
mseri committed Aug 8, 2023
1 parent 975e7e8 commit bc9c785
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
1 change: 0 additions & 1 deletion cohttp-async/examples/s3_cp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
open Base
open Core
open Async

module Time = Time_float

(* open Cohttp *)
Expand Down
7 changes: 3 additions & 4 deletions cohttp-lwt/src/connection_cache.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ end = struct
>>= fun connection ->
let res = Connection.call connection ?headers ?body meth uri in
(* this can be simplified when https://github.com/mirage/ocaml-conduit/pull/319 is released. *)
Lwt.dont_wait (fun () ->
Lwt.dont_wait
(fun () ->
res >>= fun (_, body) ->
(match body with
| `Empty | `String _ | `Strings _ -> Lwt.return_unit
| `Stream stream -> Lwt_stream.closed stream)
>>= fun () ->
Connection.close connection;
Lwt.return_unit)
(function
| Retry -> ()
| e -> raise e);
(function Retry -> () | e -> raise e);
res
end

Expand Down
30 changes: 12 additions & 18 deletions cohttp/test/test_request.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module String_io = Cohttp.Private.String_io
module StringRequest = Request.Private.Make (String_io.M)

let user_agent = Cohttp.Header.user_agent

let uri_userinfo = Uri.of_string "http://foo:bar%[email protected]"

let header_auth =
Expand Down Expand Up @@ -313,22 +312,18 @@ let null_content_length_header () =
(* The user-agent in releases contentsontains the version, we need to strip
it for the test *)
let r =
Cohttp.Request.make_for_client ~chunked:false ~body_length:0L
`PUT
Cohttp.Request.make_for_client ~chunked:false ~body_length:0L `PUT
(Uri.of_string "http://someuri.com")
in
Request.write_header r output
in
let expected = "PUT / HTTP/1.1\r\n\
host: someuri.com\r\n\
user-agent: " ^ user_agent ^ "\r\n\
content-length: 0\r\n\
\r\n"
in
let expected =
"PUT / HTTP/1.1\r\nhost: someuri.com\r\nuser-agent: "
^ user_agent
^ "\r\ncontent-length: 0\r\n\r\n"
in
Alcotest.(check string)
"null content-length header are sent"
expected
(Buffer.to_string output)
"null content-length header are sent" expected (Buffer.to_string output)

let useless_null_content_length_header () =
let output = Buffer.create 1024 in
Expand All @@ -339,14 +334,13 @@ let useless_null_content_length_header () =
in
Request.write_header r output
in
let expected = "GET / HTTP/1.1\r\n\
host: someuri.com\r\n\
user-agent: " ^ user_agent ^ "\r\n\
\r\n"
let expected =
"GET / HTTP/1.1\r\nhost: someuri.com\r\nuser-agent: "
^ user_agent
^ "\r\n\r\n"
in
Alcotest.(check string)
"null content-length header are not sent for bodyless methods"
expected
"null content-length header are not sent for bodyless methods" expected
(Buffer.to_string output)

let () =
Expand Down

0 comments on commit bc9c785

Please sign in to comment.