@@ -67,9 +67,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
6767 ->setHeader ('Allow ' , $ this ->getAllowedMethods ());
6868 }
6969 $ request = $ request ->withAttribute ('httpMethod ' , $ httpMethod );
70- $ identifier = $ request ->getAttribute ('identifier ' );
71- $ filterStr = $ request ->getUri ()->getQuery ();
72-
7370
7471 if (! method_exists ($ this , $ httpMethod ->lowercase ())) {
7572 throw (new HttpException (
@@ -79,33 +76,6 @@ public function handle(ServerRequestInterface $request): ResponseInterface
7976 ->setHeader ('Allow ' , $ this ->getAllowedMethods ());
8077 }
8178
82- if ($ httpMethod !== HttpMethod::GET && ! empty ($ filterStr )) {
83- throw new HttpBadRequestException (
84- 'Unexpected query parameter: Filter is only allowed for GET requests '
85- );
86- }
87- if ($ httpMethod === HttpMethod::GET && ! empty ($ identifier ) && ! empty ($ filterStr )) {
88- throw new HttpBadRequestException (
89- 'Invalid request: ' . $ httpMethod ->uppercase () . ' with identifier and query parameters, '
90- . " it's not allowed to use both together. "
91- );
92- }
93- if (
94- in_array ($ httpMethod , [HttpMethod::PUT , HttpMethod::POST ])
95- && $ request ->getHeaderLine ('Content-Type ' ) !== 'application/json '
96- ) {
97- throw new HttpBadRequestException ('Invalid request header: Content-Type must be application/json ' );
98- }
99- if (
100- ! in_array ($ httpMethod , [HttpMethod::PUT , HttpMethod::POST ])
101- && (! empty ($ request ->getBody ()->getSize ()) || ! empty ($ request ->getParsedBody ()))
102- ) {
103- throw new HttpBadRequestException ('Invalid request: Body is only allowed for POST and PUT requests ' );
104- }
105- if (in_array ($ httpMethod , [HttpMethod::PUT , HttpMethod::DELETE ]) && empty ($ identifier )) {
106- throw new HttpBadRequestException ("Invalid request: Identifier is required " );
107- }
108-
10979 $ this ->assertValidRequest ($ request );
11080
11181 return $ this ->handleRequest ($ request );
0 commit comments