Skip to content

Commit

Permalink
Merge pull request #21 from chimeraphp/fix-problem-detail-formatting
Browse files Browse the repository at this point in the history
Fix configuration of formatter for HTTP problem details
  • Loading branch information
lcobucci authored Jun 24, 2019
2 parents 3d66a8d + dccf576 commit 4b87a31
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion config/routing-expressive.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
<parameter>application/json</parameter>
<parameter>text/json</parameter>
<parameter>application/x-json</parameter>
<parameter>application/problem+json</parameter>
</parameter>
<parameter key="charset">true</parameter>
</parameter>
Expand Down
2 changes: 2 additions & 0 deletions config/serialization-jms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
<argument>json</argument>

<tag name="chimera.content_negotiation" format="application/json" />
<tag name="chimera.content_negotiation" format="application/problem+json" />
</service>

<service id="chimera.xml_formatter" class="Lcobucci\ContentNegotiation\Formatter\JmsSerializer">
<argument type="service" id="JMS\Serializer\SerializerInterface" />
<argument>xml</argument>

<tag name="chimera.content_negotiation" format="application/xml" />
<tag name="chimera.content_negotiation" format="application/problem+xml" />
</service>
</services>
</container>
3 changes: 2 additions & 1 deletion src/Routing/Expressive/RegisterServices.php
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,8 @@ private function registerApplication(
}

if ($formatters === []) {
$formatters['application/json'] = new Reference(Json::class);
$formatters['application/json'] = new Reference(Json::class);
$formatters['application/problem+json'] = new Reference(Json::class);
}

$applicationAllowedFormats = $this->applicationName . '.allowed_formats';
Expand Down

0 comments on commit 4b87a31

Please sign in to comment.