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

config add use_default_http_client option #430

Open
izhengzhixian opened this issue Jul 14, 2023 · 0 comments
Open

config add use_default_http_client option #430

izhengzhixian opened this issue Jul 14, 2023 · 0 comments

Comments

@izhengzhixian
Copy link

I use curl-impersonate to load as a dynamic link library to simulate browser downloads.
When the header is not set, the header of the browser will be automatically filled, but isahc has set the user-agent, so it will not be overwritten by the user-agent of chrome.
So I hope there can be a config field to turn off the default user-agent during use.

        let use_default_user_agent = request
            .extensions()
            .get::<RequestConfig>()
            .unwrap()
            .use_default_user_agent
            .unwrap_or(true);

        if use_default_user_agent {
            // Set default user agent if not specified.
            request
                .headers_mut()
                .entry(http::header::USER_AGENT)
                .or_insert(USER_AGENT.parse().unwrap());
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant