Releases: yahoo/fetchr
Fix `xhr` module interface and allow for xhr retries
Upgrading xhr to 2.0.0 broke the interface in the previous version. Fixed now.
Retry logic was never being called. Fixed now.
Updated xhr module to 2.0.0
- xhr v2.0.0 adds ie8 support
Lodash
Remove unused `crumb`
- Crumb was a special case used internally and so has been removed from code
- Documentation updated to show how to do CSRF protection generically
Dependency Updates
v0.4.1 0.4.1
`delete` everywhere
We had backwards compatibility for del
method but for sanity's sake we removed all traces of it. So now users can only use delete
methods on the client/server fetcher interface as well as the data-fetchers' interfaces.
Thanks @ptomasroos
Change `del` method to `delete`
We used del
as the delete operation method but we have now standardized the name to delete
. So now the CRUD (create
, read
, update
, and delete
) methods are all trivial to spell and use.
Feature: Custom http status codes support
Data-fetchers can specify an HTTP error statusCode (400, 404, etc) by tacking on a statusCode
property to the error object passed into the callback. If the statusCode
property exists on the error object, fetcher middleware will use that HTTP response code.
Data-fetchers can now pass a 3rd meta
parameter to their CRUD callbacks. If meta.statusCode
is set, then fetcher middleware will use that HTTP response code.
Thanks to @mtscout6 for noticing and implementing this in #22.
Bugfix: Better error handling
Fixed an issue where middleware didn't stop after throwing error. See #18 for more details.
Module export format changed to Fetchr Class
Breaking changes:
-
Fetchr now exports the class itself, rather than the class creating factory function.
var Fetcher = require('fetchr')(), //Fetcher class fetcher = new Fetcher(); //Fetcher instance
now becomes
var Fetcher = require('fetchr'), //Fetcher class fetcher = new Fetcher(); //Fetcher instance
-
addFetcher
method renamed toregisterFetcher
. This is to keep the api somewhat consistent between fetchr and dispatchr. -
Fetcher.middleware()
should no longer be mounted directly on the app. It should always be mounted on a path.app.use(Fetcher.middleware());
now becomes
app.use('/api', Fetcher.middleware());
-
pathPrefix
config option renamed toxhrPath
.- This config option used to be passed into the class creator function, but is now passed into the class upon instantiation.
- This option's value should point to the exact path the
Fetcher.middleware()
was mounted on.