mirror of
https://github.com/ocaml-tracing/ocaml-opentelemetry.git
synced 2026-03-11 04:58:39 -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 *)
|
(* send the content to the remote endpoint/path *)
|
||||||
let send (_self : t) ~(config : Config.t) ~path ~decode (bod : string) :
|
let send (_self : t) ~(config : Config.t) ~path ~decode (bod : string) :
|
||||||
('a, error) result Lwt.t =
|
('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 uri = Uri.of_string full_url in
|
||||||
|
|
||||||
let open Cohttp in
|
let open Cohttp in
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,14 @@ end = struct
|
||||||
Pbrt.Encoder.reset encoder;
|
Pbrt.Encoder.reset encoder;
|
||||||
encode x encoder;
|
encode x encoder;
|
||||||
let data = Pbrt.Encoder.to_string encoder in
|
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
|
if !debug_ || config.debug then
|
||||||
Printf.eprintf "opentelemetry: send http POST to %s (%dB)\n%!" url
|
Printf.eprintf "opentelemetry: send http POST to %s (%dB)\n%!" url
|
||||||
(String.length data);
|
(String.length data);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue