Why is x-request-cost-header null

swright-gaggle
Community Member

I am working on a solution to manage our requests to the Canvas API. While looking at the response headers I noticed that the X-Request-Cost header is null in the majority of responses that include it. For the last 24 hours only 27 out of 3401 requests have had a non-null value for X-Request-Cost. Can anyone tell me why that value might be null?

This is an example of the message in our logs:

WARN 2023-12-14 08:20:23,244 [120012] [] [CanvasArchiveProcessor-GetUsers-1869961 :: Task ID: 120012] lms.canvas.client.CanvasClient Canvas server response code 403, info: Forbidden x-request-cost-header: null, x-rate-limit-remaining header: 2.120433206290045

That only ever gets logged if we get a 403 response code. 

logger.warn(String.format(
"Canvas server response code %s, info: %s x-request-cost-header: %s, x-rate-limit-remaining header: %s",
res.getStatus(),
res.getStatusInfo(),
res.getHeaderString("X-Request-Cost"),
res.getHeaderString("X-Rate-Limit-Remaining"))
);

 

Labels (1)
0 Likes