question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for recording user-agent request header

See original GitHub issue

I know the readme clearly outlines the decision of omitting the user-agent request header from recordings. It is reiterated in the comments:

//  We never record user-agent headers as they are worse than useless -
//  they actually make testing more difficult without providing any benefit (see README)

However, please bear with me 😄 . I’m testing a scraper, which requires setting the user-agent header to a specific browser version. It would be useful if my recordings would capture that, so that if the header that I’m supposed to set explicitly is removed or changed, my tests will catch it.

I’d be willing to submit a PR for this, how do you guys feel about the following options:

  • Add an include_user_agent_reqheader option to nock.recorder.rec()
  • Only omit the user-agent header when a NodeJS header is detected

Cheers!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gr2mcommented, Apr 6, 2018

hey just a heads up that I’m out vacationing until 22nd, I’ll review open issues then 😃

0reactions
lock[bot]commented, Jan 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue and add a reference to this one if it’s related. Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

User-Agent - HTTP - MDN Web Docs - Mozilla
The User-Agent request header is a characteristic string that lets servers and network peers identify the application, operating system, ...
Read more >
HTTP/1.1: Header Field Definitions
The Accept request-header field can be used to specify certain media types which are acceptable for the response. Accept headers can be used...
Read more >
Syntax of User Agent in HTTP Header - Stack Overflow
I have Google Chrome Browser running version 89.0 The user agent of my browser displays the following string: Mozilla ...
Read more >
UserAgent Modification Rule - Requestly
The User-Agent request header is most commonly used by servers to identify its client's application.
Read more >
Using JMeter's HTTP Header Manager - BlazeMeter
The Header Manager lets you add or override HTTP request headers. Let's examine this process using a test plan which was previously recorded...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found