Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo in extract::ws #1664

Merged
merged 3 commits into from
Feb 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions axum/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- **fixed:** Fix `Allow` missing from routers with middleware
- **breaking:** Change `sse::Event::json_data` to use `axum_core::Error` as its error type ([#1762])
- **breaking:** Rename `DefaultOnFailedUpdgrade` to `DefaultOnFailedUpgrade` ([#1664])
- **breaking:** Rename `OnFailedUpdgrade` to `OnFailedUpgrade` ([#1664])

[#1762]: https://github.com/tokio-rs/axum/pull/1762
[#1664]: https://github.com/tokio-rs/axum/pull/1664

# 0.6.7 (17. February, 2023)

Expand Down
20 changes: 10 additions & 10 deletions axum/src/extract/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ use tokio_tungstenite::{
///
/// See the [module docs](self) for an example.
#[cfg_attr(docsrs, doc(cfg(feature = "ws")))]
pub struct WebSocketUpgrade<F = DefaultOnFailedUpdgrade> {
pub struct WebSocketUpgrade<F = DefaultOnFailedUpgrade> {
config: WebSocketConfig,
/// The chosen protocol sent in the `Sec-WebSocket-Protocol` header of the response.
protocol: Option<HeaderValue>,
Expand Down Expand Up @@ -268,7 +268,7 @@ impl<F> WebSocketUpgrade<F> {
/// ```
pub fn on_failed_upgrade<C>(self, callback: C) -> WebSocketUpgrade<C>
where
C: OnFailedUpdgrade,
C: OnFailedUpgrade,
{
WebSocketUpgrade {
config: self.config,
Expand All @@ -290,7 +290,7 @@ impl<F> WebSocketUpgrade<F> {
where
C: FnOnce(WebSocket) -> Fut + Send + 'static,
Fut: Future<Output = ()> + Send + 'static,
F: OnFailedUpdgrade,
F: OnFailedUpgrade,
{
let on_upgrade = self.on_upgrade;
let config = self.config;
Expand Down Expand Up @@ -342,12 +342,12 @@ impl<F> WebSocketUpgrade<F> {
/// What to do when a connection upgrade fails.
///
/// See [`WebSocketUpgrade::on_failed_upgrade`] for more details.
pub trait OnFailedUpdgrade: Send + 'static {
pub trait OnFailedUpgrade: Send + 'static {
/// Call the callback.
fn call(self, error: Error);
}

impl<F> OnFailedUpdgrade for F
impl<F> OnFailedUpgrade for F
where
F: FnOnce(Error) + Send + 'static,
{
Expand All @@ -356,20 +356,20 @@ where
}
}

/// The default `OnFailedUpdgrade` used by `WebSocketUpgrade`.
/// The default `OnFailedUpgrade` used by `WebSocketUpgrade`.
///
/// It simply ignores the error.
#[non_exhaustive]
#[derive(Debug)]
pub struct DefaultOnFailedUpdgrade;
pub struct DefaultOnFailedUpgrade;

impl OnFailedUpdgrade for DefaultOnFailedUpdgrade {
impl OnFailedUpgrade for DefaultOnFailedUpgrade {
#[inline]
fn call(self, _error: Error) {}
}

#[async_trait]
impl<S> FromRequestParts<S> for WebSocketUpgrade<DefaultOnFailedUpdgrade>
impl<S> FromRequestParts<S> for WebSocketUpgrade<DefaultOnFailedUpgrade>
where
S: Send + Sync,
{
Expand Down Expand Up @@ -410,7 +410,7 @@ where
sec_websocket_key,
on_upgrade,
sec_websocket_protocol,
on_failed_upgrade: DefaultOnFailedUpdgrade,
on_failed_upgrade: DefaultOnFailedUpgrade,
})
}
}
Expand Down