зеркало из https://github.com/Azure/ms-rest-js.git
Bring Axios interceptors back (#325)
* Bring Axios interceptors back * Bump the constant version
This commit is contained in:
Родитель
37ef9ba383
Коммит
c1742fe6a8
|
@ -121,7 +121,7 @@ export class AxiosHttpClient implements HttpClient {
|
|||
let res: AxiosResponse;
|
||||
try {
|
||||
const config: AxiosRequestConfig = {
|
||||
method: httpRequest.method as any,
|
||||
method: httpRequest.method as string,
|
||||
url: httpRequest.url,
|
||||
headers: rawHeaders,
|
||||
data: axiosBody,
|
||||
|
@ -144,6 +144,9 @@ export class AxiosHttpClient implements HttpClient {
|
|||
}
|
||||
}
|
||||
|
||||
// Workaround for https://github.com/axios/axios/issues/1158
|
||||
axios.interceptors.request.use((config: AxiosRequestConfig) => ({ ...config, method: config.method && config.method.toUpperCase() }));
|
||||
|
||||
res = await axios.request(config);
|
||||
} catch (err) {
|
||||
if (err instanceof axios.Cancel) {
|
||||
|
|
|
@ -8,7 +8,7 @@ export const Constants = {
|
|||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
msRestVersion: "1.5.2",
|
||||
msRestVersion: "1.5.3",
|
||||
|
||||
/**
|
||||
* Specifies HTTP.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"email": "azsdkteam@microsoft.com",
|
||||
"url": "https://github.com/Azure/ms-rest-js"
|
||||
},
|
||||
"version": "1.5.2",
|
||||
"version": "1.5.3",
|
||||
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",
|
||||
"tags": [
|
||||
"isomorphic",
|
||||
|
|
|
@ -41,6 +41,7 @@ class NodeHttpMock implements HttpMockFacade {
|
|||
throw new Error("Axios instance cannot be undefined");
|
||||
}
|
||||
this._mockAdapter = new MockAdapter(axiosInstance);
|
||||
axiosInstance.interceptors.request.use((config: AxiosRequestConfig) => ({ ...config, method: config.method && config.method.toLowerCase() }));
|
||||
}
|
||||
|
||||
setup(): void {
|
||||
|
|
Загрузка…
Ссылка в новой задаче