Open arlyon opened 2 years ago
Thanks, @arlyon. This sounds like a nice QoL improvement to have. Do you have an example of this flag in mind?
Locally I patched the package to add them globally (inside handleRoute) however we might not want to assume that for all users. Right now the API for createServer
while trying to feel like msw doesn't lend itself nicely to passing in any config options without breaking changes. Breaking alternatives:
createServer({page: Page, <more optional settings>}, ...handlers: RequestHandler[]);
createServer(page: Page, options: {} | undefined, ...handlers: RequestHandler[]);
createServer(page: Page, handlers: RequestHandler[], options: {});
My vote is for number 1 personally. I assume that more option requests will appear in the future as well (overriding the route path, changing the default route handler, etc).
Hi!
I was about to open a PR about catching external routes but noticed you just released a new version for it :tada: thanks!
My request is simple. I am mocking a number of api endpoints and could set the CORS headers individually in each MSW request but it would be great to set a flag in the server to set it globally instead for QoL.
Cheers
Alex