我正在使用 Jython (2.7) 和 Java (7) 代码中的 java Unirest (1.4.7) 实现。
从 Jython 代码发送 http 请求时遇到问题:
这是 Jython 代码:
import com.mashape.unirest.http.Unirest as Unirest;
r = Unirest.post("http://localhost:5002/test").field(u"this", u"makes").field(u"no", u"sense").asString();
当我在服务器端打印它时,这给了我以下请求正文:
no=sense&this=m&this=a&this=k&this=e&this=s
第一个“字段”总是“分散”在请求正文中,就好像它是一个集合一样。
Now, if i do the same thing in Java :
try {
Unirest.post("http://localhost:5002/test")
.field("this", "makes")
.field("no", "sense")
.asString();
} catch (UnirestException e) {
e.printStackTrace();
}
I get this body on the server, which is the one i expected :
no=sense&this=makes
The headers are exactly the same in both case (Excepted, obviously for the body content-length), the only thing that change is the body.
What is wrong with my Jython code ?