Closed ghost closed 3 years ago
Hi @Chattered
ksprintf
looks like a decent addition. Thanks again for the patch :) I think a ksprintf style function makes sense for the usecase you talk about.
I would like to have a function which takes a target, and turns it into a complete url with the protocol and domain name,
I think making this workflow nicer is a good step. ksprintf
helps here, and i wonder if it'll be worth it to add a routes.uri package that makes it easier to get a fully formatted Uri.t
for printing, and it could accept a Uri.t
as input for parsing. I'm making an assumption here but I think a lot of OCaml users might be using the ocaml-uri
library if they make client calls.
Hi again @anuragsoni.
I'm PRing this really just to get your take on this function. For context, I'm wanting to use
sprintf
to create internal urls to routes we serve, but it seems to be difficult to use these at the moment. For example, I would like to have a function which takes a target, and turns it into a complete url with the protocol and domain name, but I'm struggling to write this function. And going further, I'd like to have a function which takes a target, and automatically performs an internal get request. So I think I want a function likewhere, at the use site,
'a
will be something likeint -> string -> response
.With
ksprintf
, I could writeIs there another way to achieve this, or arguments against it?