有点奇怪,同样的请求在fiddler中工作,并且在应用程序中它抛出以下异常。这不是第一次发生,它从第二次开始发生。
[ERROR][TiHttpClient( 441)] (TiHttpClient-3) [27543,157068] HTTP Error (org.apache.http.client.HttpResponseException): Forbidden
[ERROR][TiHttpClient( 441)] org.apache.http.client.HttpResponseException: Forbidden
[ERROR][TiHttpClient( 441)] at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:240)
[ERROR][TiHttpClient( 441)] at ti.modules.titanium.network.TiHTTPClient$LocalResponseHandler.handleResponse(TiHTTPClient.java:199)
[ERROR][TiHttpClient( 441)] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:657)
[ERROR][TiHttpClient( 441)] at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)
[ERROR][TiHttpClient( 441)] at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1217)
[ERROR][TiHttpClient( 441)] at java.lang.Thread.run(Thread.java:1020)
[ERROR][V8Exception( 441)] Exception occurred at undefined:1: Uncaught SyntaxError: Unexpected token <
我已经交叉检查类型是否为POST,Content-Type是否始终为'application / json'。
params.headers['Content-Type'] = 'application/json';
Backbone.emulateHTTP = true; // which ensures its always POST Method.
究竟是什么让服务器因不允许拨打电话而抛出此异常?