What is the best practice to create a URI in an off-chain worker hook? The String
and format!
usage is discouraged. But what is the most convenient way to create a URI from given parts like hostname, path, and maybe query parameters or a request body?
1 Answer
Because a lot of crates or specs are using &str
as the uri
argument. I suggest still using String
in OCW. You just need to write extern crate alloc;
and use alloc::string::String
.