Skip to content

Commit dbed96f

Browse files
committed
优化 body 传参指引
1 parent 642bad0 commit dbed96f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/templates/template.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ ${options.useStaticMethod ? 'static' : ''} ${camelcase(
238238
}
239239

240240
function requestBodyString(method: string, parsedParameters: [], bodyParameter: [], requestBody: string, contentType: string, formData: string) {
241-
if (method !== 'get') {
241+
if (method === 'post' || method === 'put') {
242242
return `
243243
let data = ${parsedParameters && bodyParameter && bodyParameter.length > 0
244244
?
@@ -250,7 +250,9 @@ function requestBodyString(method: string, parsedParameters: [], bodyParameter:
250250
${contentType === 'multipart/form-data' ? formData : ''}
251251
configs.data = data;`
252252
}
253-
return '/** 适配ios13,get请求不允许带body */'
253+
return `/** 适配移动开发(iOS13 等版本),只有 POST、PUT 等请求允许带body */ \n
254+
console.warn('适配移动开发(iOS13 等版本),只有 POST、PUT 等请求允许带body')
255+
`
254256
}
255257

256258
/** serviceTemplate */

0 commit comments

Comments
 (0)