你已经指定的contentType了
uni.request在创建http request的时候,会自动把这部分内容放到header里
【 在 feng321 (sfdf) 的大作中提到: 】
: 标 题: Re: uniapp前端连java后端代码,java什么时候要content-type?
: 发信站: 水木社区 (Thu May 20 16:40:48 2021), 站内
:
: uni.request({
: url: _this.facilityUrl + 'checkResult/createInfo',
: method: 'POST',
: contentType: 'application/json',
: dataType: 'json',
: data: JSON.stringify(checkResultInfo),
: success: (res) => {
: 为何这段代码里,没有出现header,也能用?
: 【 在 guestking 的大作中提到: 】
: : 你可以稍微看一下http协议
: : 简单来说ContentType表示你的request的body里面的数据是什么格式的
: : 如果你的请求是get,那就没有body,自然就不需要指定ContentType
: : ...................
:
: --
:
: ※ 来源:·水木社区
http://www.newsmth.net·[FROM: 120.242.252.*]
--
FROM 180.167.95.*