We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf87cd7 commit 0ca64f8Copy full SHA for 0ca64f8
src/client.rs
@@ -23,10 +23,11 @@ impl HttpClient {
23
/// ```
24
pub fn new(channel_token: &str) -> HttpClient {
25
let mut headers = HeaderMap::new();
26
- headers.insert(
27
- AUTHORIZATION,
28
- format!("Bearer {}", channel_token).parse().unwrap(),
29
- );
+ if let Ok(v) = format!("Bearer {}", channel_token).parse::<String>() {
+ if let Ok(header_value) = HeaderValue::from_str(&v) {
+ headers.insert(AUTHORIZATION, header_value);
+ }
30
31
headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
32
HttpClient {
33
client: Client::new(),
0 commit comments