Skip to content

Commit ebfab4c

Browse files
committed
Remove useless methods and fix tests
1 parent 3645e4f commit ebfab4c

File tree

4 files changed

+4
-17
lines changed

4 files changed

+4
-17
lines changed

features/main/content_negotiation.feature

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ Feature: Content Negotiation support
110110
Then the response status code should be 406
111111
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
112112

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"
115115
And I send a "GET" request to "/dummies/666"
116116
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"

src/Bridge/Symfony/Bundle/EventListener/SwaggerUiListener.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,4 @@ public function onKernelRequest(GetResponseEvent $event)
3434

3535
$request->attributes->set('_controller', 'api_platform.swagger.action.ui');
3636
}
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-
}
5037
}

src/Bridge/Symfony/Bundle/Resources/config/swagger-ui.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
<services>
88

99
<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" />
1110
<tag name="kernel.event_listener" event="kernel.request" method="onKernelRequest" priority="0" />
1211
</service>
1312

tests/Fixtures/app/config/config_test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ api_platform:
4444
jsonproblem: ['application/problem+json']
4545
jsonld: ['application/ld+json']
4646
jsonapi: ['application/vnd.api+json']
47+
xml: ['application/xml', 'text/xml']
4748
graphql: true
4849
name_converter: 'app.name_converter'
4950
enable_fos_user: true

0 commit comments

Comments
 (0)