Skip to content
This repository has been archived by the owner on May 4, 2019. It is now read-only.

Expose fetchBackend as an export #97

Open
derekgreer opened this issue Oct 21, 2016 · 0 comments
Open

Expose fetchBackend as an export #97

derekgreer opened this issue Oct 21, 2016 · 0 comments

Comments

@derekgreer
Copy link

The restful.js library publishes two versions: dist/restful.js and dist/restul.standalone.js (although it's quite confusing that build/restful.standalone.js creates dist/restful.js and build.restful.fetch.js creates dist/restful.standalone.js).

The restful.js file exports the straight restful factory function which requires an httpBackend. The problem is that build/restful.standalone.js doesn't export fetchBackend and requestBackend. Therefore, it doesn't seem the distribution files actually support making a call like the one from the docs:

const api = restful('http://api.example.com', fetchBackend(fetch));

I've tested this with RequireJS and there doesn't seem to be a way to actually get to the fetchBackend() function.

define('restful', ['./Scripts/restful/restful..js'], function (export) {
     // export is equal to function(baseUrl, httpBackend)
    // there is no export.fetchBackend to expose to AMD modules using require
    return restful;
});

Perhaps this is by design, but because of #96 I'd like to be able to pass an instance of httpBackend with a patched version of fetch so that I can create my own interceptors.

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

No branches or pull requests

1 participant