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

Show raw headers in mocks #39

Open
SuperOleg39 opened this issue May 14, 2021 · 0 comments
Open

Show raw headers in mocks #39

SuperOleg39 opened this issue May 14, 2021 · 0 comments

Comments

@SuperOleg39
Copy link

Problem:

Application make request with two same headers with different values.
Teremock create mock only for last of this headers.

Solution:

Read headers from request.rawHeaders, join duplicates to array, or concatenate with ,, for example:

{
  "request": {
    "url": "...",
    "method": "...",
    "headers": {
      "user-agent": [
        "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/88.0.4298.0 Safari/537.36",
        "node-fetch"
      ]
    },
  },
}

or

{
  "request": {
    "url": "...",
    "method": "...",
    "headers": {
      "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/88.0.4298.0 Safari/537.36,node-fetch"
    },
  },
}
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