Support 429 code in drupal_http_request()

Created on 21 December 2022, over 2 years ago

Problem/Motivation

We are calling an API with drupal_http_request() and it sometimes return a 429 HTTP code when called too many times.
However, drupal_http_request() does not know about this code and transforms it into 400.
This means we can not handle this situation correctly.

Steps to reproduce

$result = drupal_http_request('https://httpstat.us/429');
var_dump($result->code);

Proposed resolution

Add 429 to the list of supported codes.

Feature request
Status

Needs review

Version

7.0 ⚰️

Component
Base 

Last updated 32 minutes ago

Created by

🇫🇷France prudloff Lille

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Open in Jenkins → Open on Drupal.org →
    Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    2,160 pass
  • last update over 1 year ago
    2,160 pass
  • 🇸🇰Slovakia poker10

    Thanks for working on this!

    I think the HTTP code 429 (Too Many Requests) is pretty common, so we can consider adding this.

    However, existing sites could have workarounds in place to check the 429 status currently (which is being transformed to code 400), so this has a minor potential to disrupt some existing sites. If we decide to commit this, I think we would need to add a change record at least to warn about this behavior change. Keeping in NR for further review.

  • Status changed to Closed: won't fix 2 months ago
  • 🇫🇷France prudloff Lille

    Drupal 7 is EOL and I don't think this affects D10+ (http-foundation knows about the 429 code).

Production build 0.71.5 2024