Specify _format as json for all XB HTTP API routes

Created on 29 May 2025, 26 days ago

Overview

\Drupal\Core\EventSubscriber\ExceptionJsonSubscriber only runs if the _format is json. The XB code handles exceptions, but this would prevent HTML from being returned and breaking the UI. If HTML is ever returned the user will see this in the UI:

SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON

This way there is always JSON.

Proposed resolution

Add _format: json to all routes, or use a route subscriber to add it.

User interface changes

✨ Feature request
Status

Active

Version

0.0

Component

Internal HTTP API

Created by

🇺🇸United States mglaman WI, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024