Skip to content

Conversation

@jrmhaig
Copy link

@jrmhaig jrmhaig commented Apr 15, 2021

We are using this gem and have identified an intermittent fault after upgrading to Ruby 2.7. The http gem is pinned to version 3 but Ruby 2.7 support was added with version 4.3.0.

I have a test to demonstrate:

require 'googlemaps/services/client'

include GoogleMaps::Services

key = '<add your API key here>'
origin = 'SW1A 1AA'
destination = 'SW1A 2AA'

c = GoogleClient.new(key: key, response_format: :json)
params = { 'origin' => origin, 'destination' => destination, 'region' => 'uk', 'alternatives' => true }

10.times do |i|
  response = c.request(url: '/maps/api/directions/json', params: params)
end

At some point you get a can't modify frozen String: "" (FrozenError) error at http-3.3.0/lib/http/response/body.rb:52. This is resolved with version 4.3 or later of http.

The http gem added support for Ruby 2.7 with version 4.3.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 97.917% when pulling 46856ac on jrmhaig:update_http into 77e8d19 on amrfaissal:master.

jrmhaig added a commit to ministryofjustice/Claim-for-Crown-Court-Defence that referenced this pull request Apr 15, 2021
This is using this branch on Github:

  https://github.com/jrmhaig/googlemaps-services/tree/update_http

One it has been merged and a new version released then that should be
used instead (see amrfaissal/googlemaps-services#13)
jrmhaig added a commit to ministryofjustice/Claim-for-Crown-Court-Defence that referenced this pull request Apr 15, 2021
This is using this branch on Github:

  https://github.com/jrmhaig/googlemaps-services/tree/update_http

One it has been merged and a new version released then that should be
used instead (see amrfaissal/googlemaps-services#13)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants