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 36
36
errors: [],
37
37
name: '_api_errors_problem ' ,
38
38
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
+ ],
40
43
hideHydraOperation: true ,
41
44
normalizationContext: [
42
45
SchemaFactory::OPENAPI_DEFINITION_NAME => '' ,
Original file line number Diff line number Diff line change @@ -91,4 +91,21 @@ public function testJsonError(): void
91
91
$ this ->assertResponseStatusCodeSame (415 );
92
92
$ this ->assertJsonContains (['detail ' => 'The content-type "application/json" is not supported. Supported MIME types are "application/xml". ' ]);
93
93
}
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
+ }
94
111
}
You can’t perform that action at this time.
0 commit comments