question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow for the Intercepters to be treated as a plugin (Pretender, MSW)

See original GitHub issue

Currently the interceptor is Pretender and it is pretty hardcoded. The intent is to isolate the Interceptor code into its own configuration, then move it to its own package to allow for other interceptors to be specified.

Currently the main entry point to the interceptor code is on the server (the get, put, post, etc methods) and the server is the this then the routes are configured. The goal would be to move these methods to the interceptor code and off the server.

Tasks

  • Move Pretender to its own config. Allow for a way to provide an alternate interceptor. Provide full backward compatibility and make Pretender the default interceptor. https://github.com/miragejs/miragejs/pull/1036
  • Move the pretender code to its own package. (currently in progress see mirage-pretender)
  • Create a package that allows MSW to be used as an interceptor with Mirage. (Currently in progress see mirage-msw)
  • Remove the Pretender code from MirageJS and require the user to choose the interceptor (Pretender, MSW, or none). This will be a breaking change in MirageJS.
  • Move the interceptor creation methods (get, put, post, etc) to the interceptor config and make the interceptor config the this when the routes function is run. The Mirage Server will be supplied as a property on the config. For most users this should not be a breaking change, but more advanced uses this could be.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
samselikoffcommented, Jun 1, 2022

Of course he can be a collab here I thought he already was! I definitely don’t want to be anyone’s bottleneck just because I don’t have the cycles to work on this anymore 👍

1reaction
cah-brian-gantzlercommented, Jun 1, 2022

Honestly it might be better to remove a hard-coded interceptor altogether and just let Mirage be concerned with turning a request into a response (and making sure it can run in both the browser and node). Then people can use pretender, MSW, even express.

The hard coded interceptor has already been removed to another repo. I just didnt remove it yet from miragejs as it would be a breaking change. But that is on the roadmap above, the 4th checkbox

Read more comments on GitHub >

github_iconTop Results From Across the Web

mswjs/interceptors: Low-level HTTP/HTTPS/XHR ... - GitHub
The class extension allows to fully utilize Node.js internals instead of polyfilling them, which results in more resilient mocks. What this library does....
Read more >
Interceptors - ActiveMQ - The Apache Software Foundation!
A plugin is an instance of the interface BrokerPlugin which allows a plugin to add itself into the broker interceptor chain, typically using...
Read more >
Untitled
Risultati genoa juve, Thuyet giang phat phap mp3, Debo paycheck meme, Sound spatialization vst, Dwyck nice and smooth, Food truck race season 4...
Read more >
Untitled
Stock xchng free stock photos, White hair treatment shampoo! ... Kayla murray instagram, Pijlsweerd wonen, Group n racing nsw, Enjoy group hotels resorts, ......
Read more >
Untitled
Hp ms 7500 motherboard drivers, Master's apprentice tab, Peso de cerebros de animales, ... Malassezia furfur natural treatment, Calwell club raffles, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found