Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Console Log Adapter #176

Open
1 task
Tracked by #172
trek opened this issue Oct 4, 2016 · 0 comments
Open
1 task
Tracked by #172

Add Console Log Adapter #176

trek opened this issue Oct 4, 2016 · 0 comments

Comments

@trek
Copy link
Member

trek commented Oct 4, 2016

Part of #172, which contains lots of explanatory
writing to make this PR more approachable by those new to Pretender. Check that Issue out!


Pretender, hypothetically, can record and playback responses. It does this by persisting the responses to localstorage. This is incredibly handy for some use cases (performance regression testing) but unwieldy for others (unit testing network requests).

For use cases like unit testing network requests it would still be useful to allow developers to easily gather data from their servers without needing to hand-create. It would also be nice to throw those results away as the server responses shift over time and get new handlers.

Off the top of my head, I can imagine a console-based solution where, in recording mode, you emit something like:

Pretender Recorded: GET /foos/12. To store this for later use add this response to your maps:

this.get('/foos/12', function(){
  return [000, { ... }, "{ ... }"];
}); 

Where 000, { ... } and "{ ... }" and the actual observed response code, headers, and body respectively.

A PR that addresses this issue:

  • adds an adapter that surfaces to the developer in some way, an observed response with instructions for how to manually update their Pretender maps to include a canned response for the observed request(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant