Skip to content

Commit

Permalink
Lavalink broken in 0.16 rc (#2319)
Browse files Browse the repository at this point in the history
Capitalization in a header is illegal and causes the bot to panic. I
posted in discord and figured it out shortly after.
https://docs.rs/http/latest/http/header/struct.HeaderName.html#method.from_static

> Panics
> This function panics when the static string is a invalid header.
>
> Until [Allow panicking in
constants](rust-lang/rfcs#2345) makes its way
into stable, the panic message at > compile-time is going to look
cryptic, but should at least point at your header value
  • Loading branch information
LinuxDevon authored Mar 5, 2024
1 parent 7166e18 commit 02514ec
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions twilight-lavalink/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -619,13 +619,13 @@ fn connect_request(state: &NodeConfig) -> Result<ClientBuilder, NodeError> {
})?
.add_header(AUTHORIZATION, state.authorization.parse().unwrap())
.add_header(
HeaderName::from_static("User-Id"),
HeaderName::from_static("user-id"),
state.user_id.get().into(),
);

if state.resume.is_some() {
builder = builder.add_header(
HeaderName::from_static("Resume-Key"),
HeaderName::from_static("resume-key"),
state.address.to_string().parse().unwrap(),
);
}
Expand Down

0 comments on commit 02514ec

Please sign in to comment.