(self)
| 118 | |
| 119 | impl IntoResponse for WebSocketUpgradeRejection { |
| 120 | fn into_response(self) -> Response { |
| 121 | match self { |
| 122 | Self::MethodNotGet => (StatusCode::METHOD_NOT_ALLOWED, "Request method must be `GET`").into_response(), |
| 123 | Self::BadUpgrade => ( |
| 124 | StatusCode::UPGRADE_REQUIRED, |
| 125 | TypedHeader(Connection::upgrade()), |
| 126 | TypedHeader(Upgrade::websocket()), |
| 127 | "This service requires use of the websocket protocol", |
| 128 | ) |
| 129 | .into_response(), |
| 130 | Self::BadVersion => ( |
| 131 | StatusCode::BAD_REQUEST, |
| 132 | "`Sec-WebSocket-Version` header did not include '13'", |
| 133 | ) |
| 134 | .into_response(), |
| 135 | Self::KeyMissing => (StatusCode::BAD_REQUEST, "`Sec-WebSocket-Key` header missing").into_response(), |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | impl WebSocketUpgrade { |
no test coverage detected