Skip to content

Commit

Permalink
fix(http): fix get invite query params (twilight-rs#2256)
Browse files Browse the repository at this point in the history
Currently the GetInvite `with_counts()` and `with_expiration()` don't
work as the query string they append uses `-` instead of `_` in the
keys, as specified in the API docs -
https://discord.com/developers/docs/resources/invite#get-invite-query-string-params.

Co-authored-by: ITOH <to@itoh.at>
  • Loading branch information
Jack073 and itohatweb authored Sep 10, 2023
1 parent fd2ad69 commit 1a8fb4e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions twilight-http/src/routing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ impl<'a> Route<'a> {
/// with_counts: true,
/// };
///
/// assert_eq!("invites/twilight-rs?with-counts=true", route.to_string());
/// assert_eq!("invites/twilight-rs?with_counts=true", route.to_string());
/// ```
///
/// [`GetInvite`]: Self::GetInvite
Expand Down Expand Up @@ -2608,7 +2608,7 @@ impl Display for Route<'_> {
f.write_str(code)?;

if *with_counts {
f.write_str("?with-counts=true")?;
f.write_str("?with_counts=true")?;
}

Ok(())
Expand All @@ -2623,11 +2623,11 @@ impl Display for Route<'_> {
f.write_str("?")?;

if *with_counts {
f.write_str("with-counts=true")?;
f.write_str("with_counts=true")?;
}

if *with_expiration {
f.write_str("with-expiration=true")?;
f.write_str("&with_expiration=true")?;
}

Ok(())
Expand Down

0 comments on commit 1a8fb4e

Please sign in to comment.