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

Provide a way to use can-fixture without XHR wrapping #89

Open
matthewp opened this issue Nov 29, 2016 · 0 comments
Open

Provide a way to use can-fixture without XHR wrapping #89

matthewp opened this issue Nov 29, 2016 · 0 comments

Comments

@matthewp
Copy link
Contributor

There are several downsides to wrapping XHR, mostly surrounding the large API surface that is required to correctly do it. It would be good for users to have a way to use can-fixture without the XHR shim.

I propose a method that, when called, will check the fixture store first and if it not found, fallback to making a normal HTTP request. I propose something like:

var fixture = require("can-fixture");

fixture.request({
  method: 'GET',
  url: '/foo/bar'
}).then(function(response){

});

We need to define the shape of that object based on what can-fixture supports. One thing that is unclear to me is if can-fixture is an XHR-only library or if we want to keep it generic enough that fetch could be used instead. If so the shape of the object might need to be more generic to support both.

An adapter could be built for can-connect that uses this method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant