Problem/Motivation

After #2831137: Remove the need for ?_format=api_json: assume the use of the 'api_json' format for routes managed by JSON API removes the need for the _format we cannot set the format early enough to get nicely formatted JSON API errors. That means that 404 errors and 403 on the route access will not get formatted according to the spec. Moreover many JSON API clients send the appropriate Accept header by default.

Proposed resolution

Add header negotiation and make it work just for JSON API. Something similar to https://www.drupal.org/node/2831137#comment-11848670 should do.

Remaining tasks

User interface changes

API changes

Data model changes

Comments

e0ipso created an issue. See original summary.

e0ipso’s picture

Status: Active » Needs review
StatusFileSize
new6.6 KB

This patch relies on https://www.drupal.org/node/2831137#comment-11969064 to be applied.

e0ipso’s picture

Title: Add Accept header negotiation for JSON API » [PP-1] Add Accept header negotiation for JSON API

Status: Needs review » Needs work

The last submitted patch, 2: 2857793--accept-header-negotiation--2.patch, failed testing.

e0ipso’s picture

e0ipso’s picture

Status: Needs work » Closed (outdated)