surf icon indicating copy to clipboard operation
surf copied to clipboard

Proposal: VCR-style request/response mocking middleware for testing

Open jbr opened this issue 4 years ago • 3 comments

This would entail an external crate that provides a surf middleware with two modes (or potentially two different middlewares)

When it's in recording mode, it transparently writes all requests and responses to disk in a configurable well-known location in a human-readable and editable format of some sort. When it's in playback mode, instead of making requests against external servers, it responds with the data from disk

references:

jbr avatar Apr 07 '21 22:04 jbr

That would be amazing, and I think an excellent use of Surf middleware!

yoshuawuyts avatar Apr 08 '21 06:04 yoshuawuyts

In case anyone sees this and is unclear what stage this proposal is at: I am not currently working on this, and will update this issue if I start. I encourage others to do likewise

jbr avatar Apr 08 '21 19:04 jbr

I'm working on this; I have a basic middleware working at https://github.com/rjframe/surf-vcr. I've only done minimal testing thus far but will be doing more in the next week or two.

rjframe avatar May 28 '21 01:05 rjframe