api: Allow incoming request method of HEAD for GET endpoints
This commit is contained in:
parent
3eb82950f2
commit
8d0f817f48
@ -176,7 +176,10 @@ impl Request {
|
|||||||
B: ::std::convert::AsRef<[::std::primitive::u8]>,
|
B: ::std::convert::AsRef<[::std::primitive::u8]>,
|
||||||
S: ::std::convert::AsRef<::std::primitive::str>,
|
S: ::std::convert::AsRef<::std::primitive::str>,
|
||||||
{
|
{
|
||||||
if request.method() != METADATA.method {
|
if !(request.method() == METADATA.method
|
||||||
|
|| request.method() == #http::Method::HEAD
|
||||||
|
&& METADATA.method == #http::Method::GET)
|
||||||
|
{
|
||||||
return Err(#ruma_common::api::error::FromHttpRequestError::MethodMismatch {
|
return Err(#ruma_common::api::error::FromHttpRequestError::MethodMismatch {
|
||||||
expected: METADATA.method,
|
expected: METADATA.method,
|
||||||
received: request.method().clone(),
|
received: request.method().clone(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user