400 response due to BadRequestHttpException thrown with filter parameter in URL in Drupal 10

Created on 25 January 2024, 11 months ago
Updated 14 September 2024, 3 months ago

Problem/Motivation

This module causes 400 responses in Drupal 10 for JSON:API requests with a filter query parameter.

This is because Symfony 6 does not support returning an array from InputBag::get() whereas Symfony 4 does.

Steps to reproduce

Install Drupal 10 with this module. Make a request to /jsonapi/action/action?filter%5Bvid.meta.drupal_internal__target_id%5D.

Drupal will issue a 400 response.

Proposed resolution

In the ResponseSubscriber, replace the call to

$filter = Filter::createFromQueryParameter($request->query->get('filter'), $resource_type, $this->fieldResolver);

with

$filter = Filter::createFromQueryParameter($request->query->all()['filter'] ?? [], $resource_type, $this->fieldResolver);

Remaining tasks

All the things

User interface changes

None

API changes

None

Data model changes

None

🐛 Bug report
Status

Closed: duplicate

Version

1.0

Component

Code

Created by

🇬🇧United Kingdom Eli-T Manchester

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