-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
Status: TriageThis is being looked at and prioritizedThis is being looked at and prioritizedType: BugSomething isn't working as documentedSomething isn't working as documented
Description
What happened?
I noticed that sometimes during an error response GitHub returns " "
or <illegal character like 'a'>{}
, which leads to Json::ParseError
errors.
I've prepared a small PR with a fix. Let me know if it works for you.
Versions
octokit
7.0
; rails
7.1.3
, ruby
3.2
Relevant log output
JSON::ParserError
Empty input (after ) at line 1, column 1 [parse.c:1062] (JSON::ParserError)
Breadcrumbs (lower - closer to exception):
# 1 relevant - octokit/error.rb
def data
@data ||=
if (body = @response[:body]) && !body.empty?
if body.is_a?(String) &&
@response[:response_headers] &&
@response[:response_headers][:content_type] =~ /json/
Sawyer::Agent.serializer.decode(body)
else
body
end
end
end
#2 relevant - multi_json/adapter.rb
def load(string, options = {})
string = string.read if string.respond_to?(:read)
fail self::ParseError if blank?(string)
instance.load(string, cached_load_options(options))
end
Code of Conduct
- I agree to follow this project's Code of Conduct
Metadata
Metadata
Assignees
Labels
Status: TriageThis is being looked at and prioritizedThis is being looked at and prioritizedType: BugSomething isn't working as documentedSomething isn't working as documented
Type
Projects
Status
🆕 Triage