serviejs / popsicle

Simple HTTP requests for node and the browser
MIT License
246 stars 19 forks source link

Mock data plugin #20

Open blakeembrey opened 9 years ago

blakeembrey commented 9 years ago

Provide the ability to mock requests and responses simply by overriding the request mechanism in use.

ondrejhanslik commented 8 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.

blakeembrey commented 8 years ago

@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).

blakeembrey commented 8 years ago

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.