138 Star 1.2K Fork 269

Troy / okhttps

 / 详情

没有添加报文体参数时,POST 请求都会以 form 表单的形式提交

已完成
拥有者
创建于  
2021-04-28 21:11

形如以下代码:

OkHttps.sync("http://xxxxx")
    .bodyType(OkHttps.JSON)
    .post();

期望发出的 Content-Typeapplication/json,但实际发出的却是 application/x-www-form-urlencoded

即:
所有应该有报文体,但没有添加 bodyPara 的请求,都会默认以空表单的形式提交。

当前的可行的避免方案有:

OkHttps.sync("http://xxxxx")
    .bodyType(OkHttps.JSON)
    .addBodyPara(null)    // 添加一个 空 报文体参数
    .post();

评论 (1)

Troy 创建了任务
Troy 关联仓库设置为ejlchina/okhttps
Troy 修改了描述
Troy 添加了
 
bug
标签
Troy 优先级设置为主要
展开全部操作日志

该问题将在 v3.0.2 中修复

Troy 修改了描述
Troy 修改了描述
Troy 任务状态待办的 修改为已完成
Troy 任务状态已完成 修改为进行中
Troy 任务状态进行中 修改为已完成
Troy 修改了描述

登录 后才可以发表评论

状态
负责人
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
参与者(1)
1393412 ejlchina zhxu 1636251845
Java
1
https://gitee.com/troyzhxu/okhttps.git
git@gitee.com:troyzhxu/okhttps.git
troyzhxu
okhttps
okhttps

搜索帮助