Skip to content

Commit b572dc8

Browse files
authored
Merge pull request #9 from mhpsy/main
fix: 微信小程序封装的http请求中的responseType不支持json,会导致请求无法回来
2 parents c4cc2be + edb15e5 commit b572dc8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/utils/http.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@ export const http = <T>(options: CustomRequestOptions) => {
55
// 1. 返回 Promise 对象
66
return new Promise<IResData<T>>((resolve, reject) => {
77
uni.request({
8-
...options,
98
dataType: 'json',
9+
// #ifndef WP-WEIXIN
1010
responseType: 'json',
11+
// #endif
12+
...options,
1113
// 响应成功
1214
success(res) {
1315
// 状态码 2xx,参考 axios 的设计

0 commit comments

Comments
 (0)