File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed
Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ public static function fromLambdaEvent(array $event) : ServerRequestInterface
3232 // TODO Parse HTTP headers for cookies.
3333 $ cookies = [];
3434
35- $ contentType = $ headers ['Content-Type ' ] ?? null ;
35+ $ contentType = $ headers ['content-type ' ] ?? $ headers [ ' Content-Type ' ] ?? null ;
3636 /*
3737 * TODO Multipart form uploads are not supported yet.
3838 */
Original file line number Diff line number Diff line change @@ -69,6 +69,20 @@ public function test POST body is parsed()
6969 self ::assertEquals (['foo ' => 'bar ' , 'bim ' => 'baz ' ], $ request ->getParsedBody ());
7070 }
7171
72+ public function test the content type header is not case sensitive ()
73+ {
74+ $ request = RequestFactory::fromLambdaEvent ([
75+ 'httpMethod ' => 'POST ' ,
76+ 'headers ' => [
77+ // content-type instead of Content-Type
78+ 'content-type ' => 'application/x-www-form-urlencoded ' ,
79+ ],
80+ 'body ' => 'foo=bar&bim=baz ' ,
81+ ]);
82+ self ::assertEquals ('POST ' , $ request ->getMethod ());
83+ self ::assertEquals (['foo ' => 'bar ' , 'bim ' => 'baz ' ], $ request ->getParsedBody ());
84+ }
85+
7286 public function test POST JSON body is not parsed ()
7387 {
7488 $ request = RequestFactory::fromLambdaEvent ([
You can’t perform that action at this time.
0 commit comments