mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-08 03:47:59 -04:00
remove trailing slash from url
This commit is contained in:
parent
e2af52ebb0
commit
883d4bb806
2 changed files with 16 additions and 2 deletions
|
|
@ -93,7 +93,14 @@ end = struct
|
|||
(* send the content to the remote endpoint/path *)
|
||||
let send (_self : t) ~(config : Config.t) ~path ~decode (bod : string) :
|
||||
('a, error) result Lwt.t =
|
||||
let full_url = config.url ^ path in
|
||||
let url =
|
||||
let url = config.url in
|
||||
if String.ends_with url ~suffix:"/" then
|
||||
String.sub url 0 (String.length url - 1)
|
||||
else
|
||||
url
|
||||
in
|
||||
let full_url = url ^ path in
|
||||
let uri = Uri.of_string full_url in
|
||||
|
||||
let open Cohttp in
|
||||
|
|
|
|||
|
|
@ -123,7 +123,14 @@ end = struct
|
|||
Pbrt.Encoder.reset encoder;
|
||||
encode x encoder;
|
||||
let data = Pbrt.Encoder.to_string encoder in
|
||||
let url = config.Config.url ^ path in
|
||||
let url =
|
||||
let url = config.Config.url in
|
||||
if String.ends_with url ~suffix:"/" then
|
||||
String.sub url 0 (String.length url - 1)
|
||||
else
|
||||
url
|
||||
in
|
||||
let url = url ^ path in
|
||||
if !debug_ || config.debug then
|
||||
Printf.eprintf "opentelemetry: send http POST to %s (%dB)\n%!" url
|
||||
(String.length data);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue