active-resource.js icon indicating copy to clipboard operation
active-resource.js copied to clipboard

Allow custom definition of request adapter

Open nicklandgrebe opened this issue 7 years ago • 0 comments

Stories

  • As a developer, I may use (or be required to use) a promise library other than the heavy-duty jQuery.ajax, so I want to be able to customize my active-resource resourceLibrary my promise library for processing async requests

Work

  • [ ] Add optional argument requestAdapter of type function when defining resourceLibrary
var resourceLibrary = ActiveResource.createResourceLibrary(
  'https://api.example.com/v1',
  {
    requestAdapter: function(method, url, data, headers) {
      return promiseLibrary([do something with these 4 args]);
    };
  }
);
  • [ ] Enable base adapter to use provided requestAdapter, or use default
  • [ ] Add a default request adapter that works with both browser and Node environments #8

nicklandgrebe avatar Jul 20 '17 16:07 nicklandgrebe