local body = "userId=31"
local params = {}
params.body = body
network.request( server/someifle.php", "POST", networkListenerRequests, params))
一切正常,但在某些随机时刻,我在networkListenerRequests中收到错误。
如果您阅读有关堆栈溢出的帖子,Spring Rest Template usage causes EOFException 他们提到一些属性保持活力。这可以设置在日冕,还是有人知道我能做的其他事情吗?
错误讯息: E / Corona(20560):错误:null W / System.err(20560):java.io.EOFException W / System.err(20560):at libcore.io.Streams.readAsciiLine(Streams.java:203) W / System.err(20560):at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579) W / System.err(20560):at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827) W / System.err(20560):at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283) W / System.err(20560):at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497) W / System.err(20560):at network.NetworkRequest $ AsyncNetworkRequestRunnable.run(NetworkRequest.java:1394) W / System.err(20560):at java.lang.Thread.run(Thread.java:841)
答案 0 :(得分:1)
您可以使用params.headers更改HTTP请求的任何标头 在你的情况下,它看起来像这样
local body = "userId=31"
local params = {}
params.body = body
params.headers = {};
params.headers["Connection"] = "close";
network.request("server/someifle.php", "POST", networkListenerRequests, params))
希望这有帮助