pipedrive/client-nodejs

Return the RateLimiting headers in metadata

lucianolxp opened this issue · 2 comments

with the rewrite in version 10 the feature of #27 was lost

currently the headers information is never returned: just the response body is parsed and _response.headers is ignored, for example:

let parsed = JSON.parse(_response.body);

we would like to write a backoff strategy for our application but it is not possible to do so with the current version of the sdk

Hey,
one possibility to get the headers, is to pass a callback function with three parameters to the request. The third parameter will include http context and you can extract the response headers from there. For example something like this:

const deals = await pipedrive.DealsController.getAllDeals(
    {start: 0, limit: 5},
    (error, response, context) => console.log('response headers', context.response.headers)
);

Would it work for you?

Yes, that worked, thank you so much!