Skip to content

Commit 45e4970

Browse files
committed
fix: taro适配器中requestOptions是可选的
1 parent 6d6129d commit 45e4970

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/adapters/taro.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const taroAdapter = (opts: {
2525
/**
2626
* Taro.request()的默认参数,每次请求前都会合并对象
2727
*/
28-
requestOptions: Taro.request.Option;
28+
requestOptions?: Taro.request.Option;
2929
}): OpenapiClientAdapter => {
3030
const {
3131
returningData = (response) => response.data,
@@ -49,7 +49,7 @@ export const taroAdapter = (opts: {
4949
url: baseURL + utils.uriConcatQuery(opts.uri, opts.query),
5050
method: opts.method.toUpperCase() as `${Uppercase<Methods>}`,
5151
data: body,
52-
header: { ...requestOptions.header, ...opts.headers },
52+
header: { ...requestOptions?.header, ...opts.headers },
5353
timeout: opts.timeout,
5454
credentials,
5555
responseType: opts.responseType === 'text' ? 'text' : undefined,

0 commit comments

Comments
 (0)