File tree Expand file tree Collapse file tree 4 files changed +4
-17
lines changed
src/Bridge/Symfony/Bundle
tests/Fixtures/app/config Expand file tree Collapse file tree 4 files changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -110,8 +110,8 @@ Feature: Content Negotiation support
110
110
Then the response status code should be 406
111
111
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
112
112
113
- Scenario : If the request format is HTML , the error should be in HTML
114
- When I add "Accept" header equal to "text/html "
113
+ Scenario : If the request format is XML , the error should be in XML
114
+ When I add "Accept" header equal to "application/xml "
115
115
And I send a "GET" request to "/dummies/666"
116
116
Then the response status code should be 404
117
- And the header "Content-Type" should be equal to "text/html ; charset=utf-8"
117
+ And the header "Content-Type" should be equal to "application/xml ; charset=utf-8"
Original file line number Diff line number Diff line change @@ -34,17 +34,4 @@ public function onKernelRequest(GetResponseEvent $event)
34
34
35
35
$ request ->attributes ->set ('_controller ' , 'api_platform.swagger.action.ui ' );
36
36
}
37
-
38
- public function addEndpointTypeToRequest (GetResponseEvent $ event )
39
- {
40
- $ request = $ event ->getRequest ();
41
- if (
42
- 'html ' !== $ request ->getRequestFormat ('' ) ||
43
- (!$ request ->attributes ->has ('_api_resource_class ' ) && !$ request ->attributes ->has ('_api_respond ' ))
44
- ) {
45
- return ;
46
- }
47
-
48
- $ request ->attributes ->set ('_api_endpoint_type ' , 'documentation ' );
49
- }
50
37
}
Original file line number Diff line number Diff line change 7
7
<services >
8
8
9
9
<service id =" api_platform.swagger.listener.ui" class =" ApiPlatform\Core\Bridge\Symfony\Bundle\EventListener\SwaggerUiListener" >
10
- <tag name =" kernel.event_listener" event =" kernel.request" method =" addEndpointTypeToRequest" priority =" 8" />
11
10
<tag name =" kernel.event_listener" event =" kernel.request" method =" onKernelRequest" priority =" 0" />
12
11
</service >
13
12
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ api_platform:
44
44
jsonproblem : ['application/problem+json']
45
45
jsonld : ['application/ld+json']
46
46
jsonapi : ['application/vnd.api+json']
47
+ xml : ['application/xml', 'text/xml']
47
48
graphql : true
48
49
name_converter : ' app.name_converter'
49
50
enable_fos_user : true
You can’t perform that action at this time.
0 commit comments