diff --git a/src/service/index/foo.ts b/src/service/index/foo.ts index acf5aa8..340b8ba 100644 --- a/src/service/index/foo.ts +++ b/src/service/index/foo.ts @@ -6,10 +6,10 @@ export interface IFooItem { /** GET 请求 */ export const getFooAPI = (name: string) => { - return http.get('/foo', { name }) + return http.get('/foo', { name }, { 'Content-Type-100': '100' }) } /** POST 请求 */ export const postFooAPI = (name: string) => { - return http.post('/foo', { name }, { name }) + return http.post('/foo', { name }, { name }, { 'Content-Type-100': '100' }) } diff --git a/src/utils/http.ts b/src/utils/http.ts index 4e3f38c..13045c9 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -48,11 +48,16 @@ export const http = (options: CustomRequestOptions) => { * @param query 请求query参数 * @returns */ -export const httpGet = (url: string, query?: Record) => { +export const httpGet = ( + url: string, + query?: Record, + header?: Record, +) => { return http({ url, query, method: 'GET', + header, }) } @@ -67,12 +72,14 @@ export const httpPost = ( url: string, data?: Record, query?: Record, + header?: Record, ) => { return http({ url, query, data, method: 'POST', + header, }) }