我正在尝试使用OkHttp进行调用,但是我遇到了异常,因为其中一个标题存在问题。标题是:
Content-Disposition: attachment; filename="O Último Caçador de Bruxas (2016) 5.1 CH Dublado 1080p.mp4"
我无法控制服务器,所以我想知道是否可以告诉OkHttp忽略该错误?
以下是完整的例外情况。
java.lang.IllegalArgumentException: Unexpected char 0xda at 24 in content-disposition value: attachment; filename="O Último Caçador de Bruxas (2016) 5.1 CH Dublado 1080p.mp4"
at okhttp3.Headers$Builder.checkNameAndValue(Headers.java:283)
at okhttp3.Headers$Builder.add(Headers.java:233)
at okhttp3.internal.http.Http2xStream.readHttp2HeadersList(Http2xStream.java:263)
at okhttp3.internal.http.Http2xStream.readResponseHeaders(Http2xStream.java:149)
at okhttp3.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:723)
at okhttp3.internal.http.HttpEngine.access$200(HttpEngine.java:81)
at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:708)
at com.facebook.stetho.okhttp3.StethoInterceptor.intercept(StethoInterceptor.java:59)
at okhttp3.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:681)
at okhttp3.internal.http.HttpEngine.readResponse(HttpEngine.java:563)
at okhttp3.RealCall.getResponse(RealCall.java:241)
at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
at okhttp3.RealCall.execute(RealCall.java:57)
答案 0 :(得分:1)
这是OkHttp中的一个错误。您可以通过禁用HTTP / 2来解决此问题。