Description
I'm trying to use the CreateRelease class.
During my first test my code failed due to an auth error.
The problem is that the github library returned a secondary error masking the root cause of the problem.
repos_service: 993 - Failed assertion: boolean expression must not be null
Tracing through the code I believe the problem is caused in the github.requestJson method.
This method calls github.request with a 'null' statusCode.
In the request method I see the following code:
_updateRateLimit(response.headers);
if (statusCode != null && statusCode != response.statusCode) {
if (fail != null) {
fail(response);
}
handleStatusCode(response);
} else {
return response;
}
My reading of this method is that if the statusCode is null then error is ignore.
The requestJson method then tries to decode the response as a CreateRelease object which of course its not.
I think the problem here is that the call to handleStatusCode
is only called if a statusCode is passed in.
I would think that the handleStatusCode method should be called even if a statusCode is not passed in.
So I think the code should read:
_updateRateLimit(response.headers);
// handle expected status codes.
if (statusCode != null && statusCode == response.statusCode) {
return response;
}
/// should we consider any 2XX code to be an OK?
if (response.statusCode != 200)
{
if (fail != null) {
fail(response);
handleStatusCode(response);
} else {
return response;
}