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

Question - Can you disable user-agent: httpyac ? #70

Closed
chrismalek opened this issue Aug 22, 2023 · 2 comments
Closed

Question - Can you disable user-agent: httpyac ? #70

chrismalek opened this issue Aug 22, 2023 · 2 comments

Comments

@chrismalek
Copy link

I can't find it in the settings or docs or I am completely blind . Is there a way to disable the user-agent: httpyac request header?

GET https://httpbin.org/status/404
accept-encoding: gzip, deflate, br
accept: */*
user-agent: httpyac

HTTP/1.1 404 NOT FOUND
access-control-allow-credentials: true
access-control-allow-origin: *
connection: close
content-length: 0
content-type: text/html; charset=utf-8
date: Tue, 22 Aug 2023 15:18:52 GMT
server: gunicorn/19.9.0

@AnWeber
Copy link
Contributor

AnWeber commented Aug 22, 2023

Currently only very difficult using Hooks API of got. but actually should be easier and I will change it.

{{
  request.options = {
    hooks: {
      beforeRequest: [(options) => {
        delete options.headers["user-agent"];
      }]
    }
  };
}}

GET https://httpbin.org/anything

@AnWeber
Copy link
Contributor

AnWeber commented Sep 2, 2023

With the next delivery you can remove the UserAgent header with this script. Unfortunately, it does not work purely configurationally, because got also sets a UserAgent automatically.

{{@request
  request.headers["User-Agent"] = undefined
}}

GET https://httpbin.org/anything

@AnWeber AnWeber closed this as completed Sep 2, 2023
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

2 participants