fix: use typed method allowance
This commit is contained in:
@@ -259,9 +259,14 @@ impl WipFsServer {
|
|||||||
fn metadata_error(&self, error: RequestMetadataError) -> Response<Vec<u8>> {
|
fn metadata_error(&self, error: RequestMetadataError) -> Response<Vec<u8>> {
|
||||||
match error {
|
match error {
|
||||||
RequestMetadataError::NotFound => empty_response(StatusCode::NOT_FOUND),
|
RequestMetadataError::NotFound => empty_response(StatusCode::NOT_FOUND),
|
||||||
RequestMetadataError::MethodNotAllowed => Response::builder()
|
error @ RequestMetadataError::MethodNotAllowed => Response::builder()
|
||||||
.status(StatusCode::METHOD_NOT_ALLOWED)
|
.status(error.status())
|
||||||
.header(ALLOW, "POST")
|
.header(
|
||||||
|
ALLOW,
|
||||||
|
error
|
||||||
|
.allow()
|
||||||
|
.expect("method-not-allowed metadata has an Allow value"),
|
||||||
|
)
|
||||||
.body(Vec::new())
|
.body(Vec::new())
|
||||||
.expect("static method response is valid"),
|
.expect("static method response is valid"),
|
||||||
RequestMetadataError::UnsupportedMediaType => {
|
RequestMetadataError::UnsupportedMediaType => {
|
||||||
|
|||||||
Reference in New Issue
Block a user