We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
通过 GlobalConfigModule.Builder 配置okhttp之后,在拦截器中添加了默认header,导致glide加载图片会有header,图片加载失败。
D: ┌────── Request ──────────────────────────────────────────────────────────────────────── D: │ URL: https://nim-nosdn.netease.im/MTEyNzQ3NTg=/bmltYV8xODYyNDk3NzEzNF8xNTk2MTA0MTY2MTM4XzFjMzgyNDg0LWFlYjUtNDQ4Ni1hNWU5LWMwMzYyYTA4ZjkzNg== D: │ D: │ Method: @post D: │ D: │ Headers: D: │ ┌ User-Agent: ChuangYeTianXia/1.9.000(Android : 8.0.0) D: │ ├ Content-Type: application/x-www-form-urlencoded D: │ ├ Content-Length: 391 D: │ ├ Host: nim-nosdn.netease.im D: │ ├ Connection: Keep-Alive D: │ └ Accept-Encoding: gzip D: │ D: │ Body: D: │ data=iL+p6Pthk6gXmUFj4qdyia/B06vwcfl9sUoBQ3YWjxV5PPnoQLDertgrBV7nakxBdeJcydxUDeB6 D: │ Hl9YCWM0YY5M93/NBZMppPH53jRLhU/Vb+YSULIDyjL/ZtuL2KRtFQGKbrR9aWlMPjYoC/Qqpv90 D: │ Llyw0YU+mXNmW7x8WDStyEBvoDggA4/AGKefAit04SlSaay3jZaW3WZ9aQR1BilHh/v94KycHXrm D: │ HQF2mlMI7ELn1bQgcpdfeNy1huYewh0J8gXNF4+Gdo8BmZLGBJ05seajmuSk D: │ &phone_type=ChuangYeTianXia/1.9.000(Android : 8.0.0) D: └───────────────────────────────────────────────────────────────────────────────────────
而且不知道为什么是post请求...
通过代码发现GlideConfiguration中 @OverRide public void registerComponents(@nonnull Context context, @nonnull Glide glide, @nonnull Registry registry) { //Glide 默认使用 HttpURLConnection 做网络请求,在这切换成 Okhttp 请求 AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context); registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(appComponent.okHttpClient())); } 使用了appComponent.okHttpClient()。
目前解决方案是重新创建了类继承AppGlideModule,不再依赖于框架的图片加载,不知道会引起什么问题,顾有此问。
The text was updated successfully, but these errors were encountered:
AppGlideModule 框架已经生成不能存在多个 ! 使用LibraryGlideModule 无法使用注解生成,要怎么替换这个配置么
Sorry, something went wrong.
我比较巧了项目里都是post请求 图片都是get请求,而且都是固定服务器头 所以是判断了如果是get请求,而且请求地址是图片服务器的,就不添加header
No branches or pull requests
Bug Description:
通过 GlobalConfigModule.Builder 配置okhttp之后,在拦截器中添加了默认header,导致glide加载图片会有header,图片加载失败。
Bug Log:
D: ┌────── Request ────────────────────────────────────────────────────────────────────────
D: │ URL: https://nim-nosdn.netease.im/MTEyNzQ3NTg=/bmltYV8xODYyNDk3NzEzNF8xNTk2MTA0MTY2MTM4XzFjMzgyNDg0LWFlYjUtNDQ4Ni1hNWU5LWMwMzYyYTA4ZjkzNg==
D: │
D: │ Method: @post
D: │
D: │ Headers:
D: │ ┌ User-Agent: ChuangYeTianXia/1.9.000(Android : 8.0.0)
D: │ ├ Content-Type: application/x-www-form-urlencoded
D: │ ├ Content-Length: 391
D: │ ├ Host: nim-nosdn.netease.im
D: │ ├ Connection: Keep-Alive
D: │ └ Accept-Encoding: gzip
D: │
D: │ Body:
D: │ data=iL+p6Pthk6gXmUFj4qdyia/B06vwcfl9sUoBQ3YWjxV5PPnoQLDertgrBV7nakxBdeJcydxUDeB6
D: │ Hl9YCWM0YY5M93/NBZMppPH53jRLhU/Vb+YSULIDyjL/ZtuL2KRtFQGKbrR9aWlMPjYoC/Qqpv90
D: │ Llyw0YU+mXNmW7x8WDStyEBvoDggA4/AGKefAit04SlSaay3jZaW3WZ9aQR1BilHh/v94KycHXrm
D: │ HQF2mlMI7ELn1bQgcpdfeNy1huYewh0J8gXNF4+Gdo8BmZLGBJ05seajmuSk
D: │ &phone_type=ChuangYeTianXia/1.9.000(Android : 8.0.0)
D: └───────────────────────────────────────────────────────────────────────────────────────
而且不知道为什么是post请求...
通过代码发现GlideConfiguration中
@OverRide
public void registerComponents(@nonnull Context context, @nonnull Glide glide, @nonnull Registry registry) {
//Glide 默认使用 HttpURLConnection 做网络请求,在这切换成 Okhttp 请求
AppComponent appComponent = ArmsUtils.obtainAppComponentFromContext(context);
registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(appComponent.okHttpClient()));
}
使用了appComponent.okHttpClient()。
Others:
目前解决方案是重新创建了类继承AppGlideModule,不再依赖于框架的图片加载,不知道会引起什么问题,顾有此问。
The text was updated successfully, but these errors were encountered: