goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.5k stars 470 forks source link

Set a custom user agent string for http checks #882

Closed fbartels closed 1 month ago

fbartels commented 3 months ago

Describe the feature:

http:
  https://www.google.com:
    status: 200
    allow-insecure: false
    no-follow-redirects: false
    timeout: 1000
    username: ""
    password: ""
    ca-file: ""
    cert-file: ""
    key-file: ""
    proxy: ""
    skip: false
    method: GET

Describe the solution you'd like

Describe alternatives you've considered

aelsabbahy commented 3 months ago

Make sense, marked as approved. Feel free to submit a PR if you're interested in the change otherwise, I'll eventually get around to it.

catdevman commented 3 months ago

I'm going to take a shot at this if no one else is already working on it.

catdevman commented 2 months ago

@fbartels just FYI you can override this on a per check basis.

http:
  https://www.google.com:
    status: 200
    allow-insecure: false
    no-follow-redirects: false
    timeout: 1000
    username: ""
    password: ""
    ca-file: ""
    cert-file: ""
    key-file: ""
    proxy: ""
    skip: false
    method: GET
    request-headers:
        - 'user-agent: whatever/you/want/goes/here'
fbartels commented 2 months ago

@catdevman thanks or the hint regarding request-headers. I did miss that setting custom headers is already possible in http checks. I can confirm that this works as a workaround until goss sets a proper user-agent.