Skip to content
New issue

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

很棒 写了好几个APP 都用了这款 #54

Open
DD924 opened this issue Jan 27, 2022 · 1 comment
Open

很棒 写了好几个APP 都用了这款 #54

DD924 opened this issue Jan 27, 2022 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@DD924
Copy link

DD924 commented Jan 27, 2022

最近遇到一个问题 就是 一个URL 多次重定向,我该如何很方便的 取出 头中的重定向网址和 cookies

@troyzhxu
Copy link
Owner

troyzhxu commented Jan 27, 2022

先配置 不自动跟随重定向:

HTTP http = HTTP.builder()
    .config((OkHttpClient.Builder builder) -> {
        // 阻止自动重定向
        builder.followRedirects(false);
        builder.followSslRedirects(false);
    })
    .build();

然后在请求的响应头中就可以拿到 重定向地址了

@troyzhxu troyzhxu added the help wanted Extra attention is needed label Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants