If you take a look at WP_HTTP->request()
(which all related functions wrap) it provides a filter hook for the purpose of overriding making a request in favor of returning arbitrary data as response:
// Allow plugins to short-circuit the request
$pre = apply_filters( 'pre_http_request', false, $r, $url );
if ( false !== $pre )
return $pre;
Related Posts:
- How to control accept encoding on HTTP API requests?
- Mutual Authentiction on HTTPS with WordPress HTTP API?
- How to use WordPress HTTP API to download file from remote location
- HTTP digest authentication using wp_remote_get
- Error timed out with succesfull wp_remote_post
- Difference between wp_remote_post and wp_safe_remote_post
- How to consume and display external data in WordPress from another website
- cURL vs WP_Http for safety?
- Posting an XML request using HTTP API
- Is it possible to process $_POST / inbound http request in way to automatically create WordPress post?
- What’s the best way to detect referrer?
- Behind-the-scenes HTTP Request?
- Sending JSON Payload using Request::request_multiple()
- wp remote post getting a 404 error code
- wp_remote_request header error even though working properly with cURL
- Proper context for wp_remote_post()
- How to add code to HTTP header
- Using WP_Http to post data to Webservice without blocking caller script
- Testing hooks callback
- Where can I find documentation for the WP_UnitTestCase factory classes?
- Filter any HTTP request URI?
- How to remove rest api link: in http headers?
- Proper unit testing in WordPress
- WordPress Themes and PHP unit
- How to use the HTTP API with a Proxy?
- How to set up a user inside unit tests
- WordPress test environment on windows
- PHPUnit testing WordPress Plugin
- Writing a unit test for add_menu_page
- Can’t get the phpunit core test for WordPress to work [closed]
- Using wp_mail during an integration test
- Implement phpunit testing on a plugin
- How to run multiple Async HTTP requests in WordPress?
- What areas to Unit test while building a plugin?
- Why Can’t PHPUnit UnitTest My WordPress Website
- how to test a theme upgrade
- Is there any way of of making an admin-ajax request without the use of die()?
- Revert WordPress default options after a PHPUnit test has run
- parse XML from URL (via SOAP)
- Unit testing wordpress plugins with plugin options
- How can I properly set up dependencies in automated testing?
- Install and load additional plugins when running unit tests
- Unit Testing a Plugin functionality with cron
- Connect external web app to wordpress
- API JSON Data in WordPress
- How do I mock get_adjacent_post for testing
- Storing an XML Response (Transient)?
- Why is WP_Mock not used instead of WP_UnitTestCase for writing unit tests by most plugins?
- DataBase connection problem with PHPUnit and WordPress
- What is the official way to consume the WordPress API? (api.wordpress.org)
- Allow download_url for lan addresses
- WordPress function gives different results outside vs inside PHPUnit test
- How to set charset for wp_remote_post request?
- Setting Up PHPUnit tests for WP development on Windows
- unit testing admin password
- wp_remote_post with ssl:// protocol
- How to verify meta box is registered in Unit Testing?
- Extending WordPress REST API
- using wp_remote_get to retrieve own url on local host
- Does WordPress’s HTTP API use any caching?
- How to convert this cURL to wp_remote_get?
- How exactly *does* unit testing work for themes?
- How deactivate the http-api
- Unit Test in WordPress
- What is the best way to create a factory for unit test objects?
- Cache WP remote_get HTTP Response using Transients
- Return WP_Error as WP_REST_Response
- How do I phpunit test a post output process?
- Coverage in integration tests
- Unit testing a plugin with a theme dependency
- How to retain table data in wordpress phpunit tests
- Is there a way to mock update_option for unit testing?
- How do I create an rssfeed from the contents on this page?
- WP http XML response HTML encoding and image display problems
- WordPress Automatic Testing Probelm
- Save external API calls in WordPress
- http_response_timeout filter not working
- Add information to HTTP Header in WordPress Plugin
- wp_remote_post empty $_POST
- External HTTP API calls slowing down WordPress admin [closed]
- Write integration test for rest_pre_serve_request
- Integration tests test script enqueue/register fails
- How to do an unit test for the admin dashboard
- How to set a header in wp_safe_remote_get()?
- Need help creating asynchronous data scraper in WordPress
- How do I unit test a plugin with forms?
- Get the name WordPress default theme in the core
- Call external API in wordpress based on user input
- How can I enable IDE integration (autocomplete) for WordPress test suite
- Unit Testing action hook
- WordPress and WordPress-test-lib not getting added to tmp folder
- Unable to find PHPUnit code coverage stats
- Turn twitter-urls into list timelines?
- Unit Test ignores stubbed method second time around in a dataProvider
- Get full page HTML for a non-public WordPress page
- How to use wp_http with https-pages?
- Using the wp_remote_post response body
- How to use the HTTP API (wp_remote_get) instead of cURL?
- PHPUnit Ajax Serialization of ‘Closure’ is not allowed
- PHPUnit Testing Installation Issue