Closed sposnjak-cpot closed 2 years ago
let request = Request::builder().uri(url).method("GET").header("Authorization", api_key).body("").unwrap();
The body of the request must be empty, not an empty string. Use body(())
instead of body("")
, then it should be OK.
Thank you! That solved the issue.
I am trying to send custom header to the WS server. First I created a "regular" connection to check if it works correctly as:
This works nicely - it opens the connection and all. Next I need to supply the Authenticate header on the connection I tried to do it in this way:
This code will not compile as the compiler claims that:
I am not sure what I am doing wrong here? Some helpful hint would be appreciated.