2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00
Files
Willian Agostini 696fa753c5 fix: status is missing in AxiosError on and after v1.13.3 (#7368)
* test: add error handling tests for fetch and http adapters with status code

* fix: improve error handling in fetch adapter by including request and response in AxiosError

* fix: skip fetch test if fetch is not supported

* Update lib/adapters/fetch.js

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

* fix: improve error handling in fetch adapter by using the correct request object

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-02-04 09:47:12 +02:00
..

axios // adapters

The modules under adapters/ are modules that handle dispatching a request and settling a returned Promise once a response is received.

Example

var settle = require('../core/settle');

module.exports = function myAdapter(config) {
  // At this point:
  //  - config has been merged with defaults
  //  - request transformers have already run
  //  - request interceptors have already run
  
  // Make the request using config provided
  // Upon response settle the Promise

  return new Promise(function(resolve, reject) {
  
    var response = {
      data: responseData,
      status: request.status,
      statusText: request.statusText,
      headers: responseHeaders,
      config: config,
      request: request
    };

    settle(resolve, reject, response);

    // From here:
    //  - response transformers will run
    //  - response interceptors will run
  });
}