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

Update msw and allow using existing msw server #221

Closed
mlev opened this issue Jun 25, 2024 · 3 comments
Closed

Update msw and allow using existing msw server #221

mlev opened this issue Jun 25, 2024 · 3 comments

Comments

@mlev
Copy link

mlev commented Jun 25, 2024

Would be great to update to use msw v2, which has been out for approx 8 months. I was getting some weird issues and worked out it was because we're on v2 and this lib is only v1.

And generally for integration it would also be nice if you could optionally pass in an existing MSW server instance for this lib to reuse rather than creating it's own instance. i.e. as per recommendations from msw maintainer: mswjs/msw#821

Thanks!

@levino
Copy link
Owner

levino commented Jun 25, 2024

Hi @mlev. This sounds like a good idea. Are you able to make a PR with the changes?

@mlev
Copy link
Author

mlev commented Jun 29, 2024

Have created PR. Instead of passing an msw server I exported the handler creation logic. Existing behaviour is unchanged but for my use case with my own server I wouldn't call jwksMock.start() any more. I already have my own msw server listening and I add the jwks handler to it with server.use(jwksMock.jwksHandler()).

Make sense?

@levino levino changed the title Support for msw v2 Update msw and allow using existing msw server Jul 17, 2024
@levino levino closed this as completed in e8f341f Jul 17, 2024
@levino
Copy link
Owner

levino commented Jul 17, 2024

Part of 3.2.2

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 a pull request may close this issue.

2 participants