Description
Environment details
- OS: Ubuntu 16.04
- Ruby version: 2.6.2
- Gem name and version: google-api-client (0.37.1)
Steps to reproduce
There seems to be a breaking change on Gmail backend where if there are no results for the request from the server, it will respond with 204 No Content (empty body). google-api-ruby-client
attempts to parse this response and raises a MultiJson::ParseError (JSON::ParserError)
instead of returning an empty list of results.
Code example
service = Google::Apis::GmailV1::GmailService.new
service.authorization = # set credentials...
service.list_user_setting_filters(google_user_id)
The response is from Gmail is 204 No content. The last line raises MultiJson::ParseError (JSON::ParserError)
This only happens when there are no results to be returned and only for some users, ie. only happens to a small % of users with no filters.
For the affected user the response code is 204 with empty body:
@http_body=#<HTTP::Message::Body:0x00007f99d313f500 @body="", @size=0, @positions=nil, @chunk_size=nil>, @previous=nil>
For unaffected users, the response code is 200 with a valid JSON body:
@http_body=#<HTTP::Message::Body:0x00007f99cd60e780 @body="{}\n", @size=0, @positions=nil, @chunk_size=nil>, @previous=nil>
In addition, the issue is not limited to list_user_setting_filters
call. Other calls are also affected, eg. list_user_messages
.
Activity