Fix content-type header for Drupal 11 compatibility

Created on 23 May 2024, 6 months ago
Updated 2 August 2024, 4 months ago

Problem/Motivation

CaptchetatController getCaptcha method response doesn't specify a content-type header.

Javascript and image are returned with Drupal default text/html;charset=utf-8 content-type header.

Because of this invalid content-type header, Javascript is not executed on Drupal 11.

I think this behavior should also be fixed for Drupal 9 and 10.

Steps to reproduce

Try to display a CaptchEtat captcha on Drupal 11.

Check content-type header of /simple-captcha-endpoint requests in the web developer console of your browser.

Proposed resolution

Use the Drupal http client instead of curl to easily add the content-type header value provided by the call to the CapchEtat API endpoint to the getCaptcha controller method response.

With this fix, CaptchEtat works perfectly fine on Drupal 11 (Captcha module needs to be patched though).

Remaining tasks

Validate MR.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇫🇷France mably

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