Closed gadenbuie closed 2 years ago
I renamed the headers item response_headers
and added the response content as response_content
.
I hope it's okay, but I rolled #116 into this PR as it also touches gh_error()
and resolves an issue that occurs with conditional requests that don't return a response body. (In short, when the body is empty res
is raw(0)
so gh_error()
fails when trying to access res$message
.)
Thanks again and sorry for the long wait! I removed #116 because I think we handle that elsewhere now.
This small PR returns the response headers as
$response
in the error condition thrown fromgh_error()
to make it possible to use information returned in the headers by GitHub when handling the error.In particular, this is useful when reaching rate limits as it would allow users to use the
Retry-After
orX-RateLimit-Reset
properties to wait for the rate limit to reset or the retry-after period to pass.I used
response
to align with the attribute name in a successful response.