Open blakeembrey opened 9 years ago
It's easier to mock data on a proxy, not in the library that is performing the requests. It's also easier to mantain because you don't have to clutter production code with mocking code but keep it as a part of build set up.
@ondrejhanslik I agree. I thought it'd be a nice demo of a plugin if it can show the transport mechanism being overridden, but yeah, it's probably going to cause confusion. Something that is interesting and I thought about with this is a plugin that adds caching of requests to the node handler (for example, writes to filesystem or stores requests in memory and handles caching like the browser does).
I'm going to close this, I have https://github.com/blakeembrey/popsicle-cache now which is intercepting HTTP requests and using the transport layer.
Provide the ability to mock requests and responses simply by overriding the
request
mechanism in use.