Fix content-type header for Drupal 11 compatibility

Created on 23 May 2024, about 1 month ago
Updated 26 May 2024, about 1 month 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.69.0 2024