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

feat(fromTraffic): match query parameters #46

Merged
merged 7 commits into from
Jul 11, 2024

Conversation

weyert
Copy link
Collaborator

@weyert weyert commented Jul 10, 2024

Add support to strictly match query parameters of a HAR file's request entry by matching the query string with the queryString-property of the entry.

fixes #45

weyert added 2 commits July 10, 2024 01:03
Add support to strictly match query parameters of a HAR file's request entry
by matching the query string with the `queryString`-property of the entry.
@weyert weyert requested a review from kettanaito July 10, 2024 00:36
@@ -56,7 +56,7 @@
"@types/compression": "^1.7.1",
"@types/node": "18",
"compression": "^1.7.4",
"jsdom": "^22.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jsdom has a bug in URLSearchParams.prototype.delete. It ignores explicit value argument when dealing with multiple key/value pairs.

Copy link
Member

@kettanaito kettanaito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Thanks, @weyert 👏

I've added a few changes:

  • Support for multi-value search parameters;
  • Dropped jsdom in favor of happy-dom (fewer bugs);
  • Added some test cases;
  • Polished the implementation.

@kettanaito kettanaito changed the title feat: add support to strictly match query parameters feat(fromTraffic): match query parameters Jul 11, 2024
@kettanaito kettanaito marked this pull request as ready for review July 11, 2024 14:18
@kettanaito
Copy link
Member

TIL

HappyDOM returns case-sensitive header names while neither the browser nor Node.js does that. Header names are lowercased per spec.

@kettanaito kettanaito merged commit 4bd9d80 into main Jul 11, 2024
1 check passed
@kettanaito kettanaito deleted the add-query-string-matching branch July 11, 2024 14:52
@kettanaito
Copy link
Member

Released: v0.2.0 🎉

This has been released in v0.2.0!

Make sure to always update to the latest version (npm i @mswjs/source@latest) to get the newest features and bug fixes.


Predictable release automation by @ossjs/release.

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

Successfully merging this pull request may close these issues.

HAR: Respect query parameters
2 participants