File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change 3636 errors: [],
3737 name: '_api_errors_problem ' ,
3838 routeName: '_api_errors ' ,
39- outputFormats: ['json ' => ['application/problem+json ' , 'application/json ' ]],
39+ outputFormats: [
40+ 'json ' => ['application/problem+json ' , 'application/json ' ],
41+ 'xml ' => ['application/xml ' , 'text/xml ' ],
42+ ],
4043 hideHydraOperation: true ,
4144 normalizationContext: [
4245 SchemaFactory::OPENAPI_DEFINITION_NAME => '' ,
Original file line number Diff line number Diff line change @@ -91,4 +91,21 @@ public function testJsonError(): void
9191 $ this ->assertResponseStatusCodeSame (415 );
9292 $ this ->assertJsonContains (['detail ' => 'The content-type "application/json" is not supported. Supported MIME types are "application/xml". ' ]);
9393 }
94+
95+ public function testXmlError (): void
96+ {
97+ self ::createClient ()->request ('GET ' , '/notfound ' , [
98+ 'headers ' => ['accept ' => 'text/xml ' ],
99+ ]);
100+
101+ $ this ->assertResponseStatusCodeSame (404 );
102+ $ this ->assertResponseHeaderSame ('content-type ' , 'application/xml; charset=utf-8 ' );
103+
104+ self ::createClient ()->request ('GET ' , '/notfound ' , [
105+ 'headers ' => ['accept ' => 'application/xml ' ],
106+ ]);
107+
108+ $ this ->assertResponseStatusCodeSame (404 );
109+ $ this ->assertResponseHeaderSame ('content-type ' , 'application/xml; charset=utf-8 ' );
110+ }
94111}
You can’t perform that action at this time.
0 commit comments