nicklandgrebe / active-resource.js

ActiveResource.js - API resource relational mapping in JavaScript
https://active-resource.js.org
MIT License
133 stars 20 forks source link

Working with response headers #25

Closed ch-tactica closed 6 years ago

ch-tactica commented 6 years ago

Looking through the source, I couldn't determine if there was any way at present to parse response headers for any of the standard resource requests.

My use case is that I'm working with an external token authentication library that implements sliding-sessions using response headers for each request.

I think something to the effect of the following would be ideal:

Order.find(1)
.then (order, response) =>
  console.log("Here's the new access token:", response.headers['access-token']);
ch-tactica commented 6 years ago

I came across axios interceptors earlier today which seems to solve the issue for me.