wordpress-playground icon indicating copy to clipboard operation
wordpress-playground copied to clipboard

Filter Requests library to use the Fetch handler.

Open dd32 opened this issue 1 year ago • 1 comments

What is this PR doing?

As the 'http_api_transports' filter is deprecated and no longer actively used, this filters the Requests library to always use the Fetch transport.

What problem is it solving?

When the kitchen sink is enabled (ie. streams extension) Requests is using that for HTTP requests, rather than using the Fetch transport (and does not automatically fallback to it).

How is the problem addressed?

Filters the Requests internals to always use the transport.

Testing Instructions

  1. Load with kitchen sink
  2. Observe failing requests, and no attempt to use Fetch
  3. Apply Patch
  4. Load with kitchen sink
  5. Observe requests succeed (or fail with CORS issues via fetch).

Fixes #1047

dd32 avatar Feb 23 '24 01:02 dd32

Surfacing this comment: https://github.com/WordPress/wordpress-playground/issues/1047#issuecomment-1993909379

adamziel avatar Mar 13 '24 09:03 adamziel

I rebased and adjusted this PR, we should stop seeing the console warnings about the http_api_transports filter in wp-admin.

adamziel avatar Apr 16 '24 20:04 adamziel