Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cn.hutool.http.HttpUtil#post(java.lang.String, java.lang.String) 这个方法按文档的标准参数调用报异常 #3592

Closed
songpaopao opened this issue May 20, 2024 · 5 comments

Comments

@songpaopao
Copy link

songpaopao commented May 20, 2024

版本情况

JDK版本: openjdk_8_201
hutool版本: 5.X.X(请确保最新尝试是否还有问题)

问题描述(包括截图)

  1. 复现代码
cn.hutool.http.IssueI7WZEOTest#postTest

{
    "code": 201,
    "msg": "解析失败"
}

image

  1. 堆栈信息
cn.hutool.http.HttpRequest#body(java.lang.String, java.lang.String)
原因在于这个方法在标准参数的时候 无法正确解析到content type
  1. 测试涉及到的文件(注意脱密)

比如报错的Excel文件,有问题的图片等。

@looly
Copy link
Member

looly commented May 20, 2024

这个远程接口失效或变更了。

我把test加ignore吧。

@looly looly closed this as completed May 20, 2024
@songpaopao
Copy link
Author

我想说明的是
cn.hutool.http.HttpRequest#body(java.lang.String, java.lang.String)
原因在于这个方法在标准参数的时候 无法正确解析到content type
理论上按照文档是要塞一个的

@songpaopao
Copy link
Author

image
ho红框中的方法是进不去的

@looly
Copy link
Member

looly commented May 20, 2024

对啊,当传入的是a=1&b=2这种时,是www-form-urlencode形式,这个非JSON也非XML,也可以不传,则默认是这个格式。

@songpaopao
Copy link
Author

没问题 我理解错了 我想成form表单了 我的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants