Skip to content

Commit

Permalink
remove use of String.ends_with for compat with 4.08
Browse files Browse the repository at this point in the history
  • Loading branch information
c-cube committed Sep 1, 2023
1 parent 883d4bb commit 063c046
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/client-cohttp-lwt/opentelemetry_client_cohttp_lwt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ end = struct
('a, error) result Lwt.t =
let url =
let url = config.url in
if String.ends_with url ~suffix:"/" then
if url <> "" && String.get url (String.length url - 1) = '/' then
String.sub url 0 (String.length url - 1)
else
url
Expand All @@ -115,8 +115,7 @@ end = struct
try%lwt
let+ r = Httpc.post ~headers ~body uri in
Ok r
with e ->
Lwt.return @@ Error e
with e -> Lwt.return @@ Error e
in
match r with
| Error e ->
Expand Down
2 changes: 1 addition & 1 deletion src/client-ocurl/opentelemetry_client_ocurl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ end = struct
let data = Pbrt.Encoder.to_string encoder in
let url =
let url = config.Config.url in
if String.ends_with url ~suffix:"/" then
if url <> "" && String.get url (String.length url - 1) = '/' then
String.sub url 0 (String.length url - 1)
else
url
Expand Down

0 comments on commit 063c046

Please sign in to comment.