2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-30 15:24:11 +03:00

Refactored adapters loader; (#5277)

Co-authored-by: Jay <jasonsaayman@gmail.com>
This commit is contained in:
Dmitriy Mozgovoy
2022-11-22 20:53:56 +02:00
committed by GitHub
parent a3d901777b
commit d032edda08
9 changed files with 89 additions and 59 deletions
+2 -1
View File
@@ -5,6 +5,7 @@ import isCancel from '../cancel/isCancel.js';
import defaults from '../defaults/index.js';
import CanceledError from '../cancel/CanceledError.js';
import AxiosHeaders from '../core/AxiosHeaders.js';
import adapters from "../adapters/adapters.js";
/**
* Throws a `CanceledError` if cancellation has been requested.
@@ -45,7 +46,7 @@ export default function dispatchRequest(config) {
config.headers.setContentType('application/x-www-form-urlencoded', false);
}
const adapter = config.adapter || defaults.adapter;
const adapter = adapters.getAdapter(config.adapter || defaults.adapter);
return adapter(config).then(function onAdapterResolution(response) {
throwIfCancellationRequested(config);