Using Angular JS's $resource service, is there a way to specify the If-None-Match and ETag headers for the 2nd, 3rd, etc polls of a resource?
var SummarySearch = $resource(<<apiurl>>,
{ },
{
get: {
method: 'GET',
headers: {
'x-header': 'id'
}
}
});
I've gotten this to work for setting a constant header (it's just x-header: id
in this case), but I need something that varies per request, based on the ETag I last saw.
Update:
transformRequest
looked promising, but I don't have access to the data that I initiated the request with, or the URL where that data ended up. As far as I can tell I only have access to the body I'd be POSTing (undefined in my case since I'm doing a GET) and the headersGetter function.