Hi,
I need to send many requests to fetch some issues from Jira. I occasionally get responses with 429 status-code from Jira Cloud REST API. I have read in https://developer.atlassian.com/cloud/jira/platform/rate-limiting/ that x-ratelimit-nearlimit header is added to the responses when less than 20% budget for calls remain. However, when I send requests with @forge/bridge’s requestJira method and try to read this header from the response, it is null. How can I read this header? Below, you can find how I try to read it.
Best regards,
Odin
const response = await requestJira("...");
const isNearLimit = response.headers["x-ratelimit-nearlimit"]; // isNearLimit is undefined for me.
According to the Fetch API spec, headers is not a normal object that you can index into. You have to get(name). Fortunately, the spec also says “The name is case-insensitive.”
I’ll admit I haven’t tried this as I don’t have any expensive requests handy. But I’m counting on the Atlassian Forge polyfill for Fetch being compliant with the spec.