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: add options to ignore query params #191

Merged
merged 1 commit into from
Sep 19, 2023
Merged

feat: add options to ignore query params #191

merged 1 commit into from
Sep 19, 2023

Conversation

JoaoBrlt
Copy link
Contributor

Changes:

  • Added ignoreQueryParams option (defaults to false) to the mock object config to ignore query parameters on a per-request basis.
  • Added ignoreQueryParams option (defaults to false) to the global config to ignore query parameters globally.
  • Added tests to ensure the new options work as expected.
  • Added documentation for the new options.

@netlify
Copy link

netlify bot commented Sep 14, 2023

Deploy Preview for storybook-addon-mock ready!

Name Link
🔨 Latest commit 9e1a104
🔍 Latest deploy log https://app.netlify.com/sites/storybook-addon-mock/deploys/6509fe4ba288990008f82dea
😎 Deploy Preview https://deploy-preview-191--storybook-addon-mock.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@JoaoBrlt
Copy link
Contributor Author

Resolves #78

@JoaoBrlt JoaoBrlt changed the title Add options to ignore query params feat: add options to ignore query params Sep 14, 2023
@JoaoBrlt
Copy link
Contributor Author

Hi @nutboltu!
The pipeline seems to be failing now.
Everything works on my side with both node 16 and 18.
It seems to be related with the latest merge to master.
Don't hesitate to tell me if I can help you with something 😉

@nutboltu
Copy link
Collaborator

Yeah. The master pipeline is failing due to missing pollyfills for Header object. You may take a look at it if you have time.

I'm AFK and would be able to look later this week. I'll keep you updated. Let me know if you have any urgency.

@JoaoBrlt
Copy link
Contributor Author

JoaoBrlt commented Sep 17, 2023

Hey!
Indeed, it seems that the Fetch API is only fully supported from Node 18 onwards. Before that, the feature was behind the --experimental-fetch runtime flag.
I managed to fix the pipeline by installing whatwg-fetch, which seems to be the most popular polyfill for the Fetch API, and importing it into the "response.js" file.
Of course, we could do it better by using Webpack and adding the polyfill package as an entry but I didn't want to introduce too many changes 😊

Copy link
Collaborator

@nutboltu nutboltu left a comment

Choose a reason for hiding this comment

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

@JoaoBrlt just left few comments

packages/mock-addon/package.json Outdated Show resolved Hide resolved
packages/mock-addon/src/utils/faker.js Outdated Show resolved Hide resolved
packages/mock-addon/src/utils/request.js Outdated Show resolved Hide resolved
@nutboltu
Copy link
Collaborator

@JoaoBrlt apologies, I have to take the "whatwg-fetch" package to pass my other builds. Can you please fix the conflicts. I'll merge this PR then

@JoaoBrlt
Copy link
Contributor Author

@nutboltu No problem, I removed the commit with "whatwg-fetch" and updated the PR to keep only the global option 😉

Copy link
Collaborator

@nutboltu nutboltu left a comment

Choose a reason for hiding this comment

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

Awesome work @JoaoBrlt !

@nutboltu nutboltu merged commit 7ae2a63 into linearlabs-workspace:master Sep 19, 2023
6 checks passed
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.

None yet

2 participants