2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-20 20:00:40 +03:00

fix(types): renamed RawAxiosRequestConfig back to AxiosRequestConfig; (#5486)

This commit is contained in:
Dmitriy Mozgovoy
2023-01-23 01:09:18 +02:00
committed by GitHub
parent 6486929f70
commit 2a71f49bc6
4 changed files with 115 additions and 102 deletions
+7 -7
View File
@@ -1,5 +1,5 @@
import axios, {
RawAxiosRequestConfig,
InternalAxiosRequestConfig,
AxiosRequestConfig,
AxiosHeaders,
AxiosRequestHeaders,
@@ -22,7 +22,7 @@ import axios, {
spread
} from 'axios';
const config: RawAxiosRequestConfig = {
const config: AxiosRequestConfig = {
url: '/user',
method: 'get',
baseURL: 'https://api.example.com/',
@@ -60,11 +60,11 @@ const config: RawAxiosRequestConfig = {
cancelToken: new axios.CancelToken((cancel: Canceler) => {})
};
const nullValidateStatusConfig: RawAxiosRequestConfig = {
const nullValidateStatusConfig: AxiosRequestConfig = {
validateStatus: null
};
const undefinedValidateStatusConfig: RawAxiosRequestConfig = {
const undefinedValidateStatusConfig: AxiosRequestConfig = {
validateStatus: undefined
};
@@ -515,7 +515,7 @@ axios.get('/user', {
// issue #5034
function getRequestConfig1(options: RawAxiosRequestConfig): RawAxiosRequestConfig {
function getRequestConfig1(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
@@ -525,7 +525,7 @@ function getRequestConfig1(options: RawAxiosRequestConfig): RawAxiosRequestConfi
};
}
function getRequestConfig2(options: RawAxiosRequestConfig): RawAxiosRequestConfig {
function getRequestConfig2(options: AxiosRequestConfig): AxiosRequestConfig {
return {
...options,
headers: {
@@ -609,7 +609,7 @@ for (const [header, value] of headers) {
config.headers.foo = "1";
config.headers.set('bar', '2');
config.headers.set({myHeader: "myValue"})
config.headers = new axios.AxiosHeaders({myHeader: "myValue"});
config.headers = new AxiosHeaders({myHeader: "myValue"});
config.headers = {...config.headers} as AxiosRequestHeaders;
return config;
},