Fix net http request on ruby 2.7 #130
Merged
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
I've just noticed that #109 isn't working under 2.7 (my bad on not trying that version locally and thinking that it'd run on CI before getting merged 😬 🤦♂️).
The reason is that Ruby 3.0 added the ability to set headers on the
Net::HTTP.get
call, while 2.7 doesn't have that, and so it breaks.This fixes that by changing the Get request.
I've tried and the
Content-Type
header is not required by the NPM server (so a simpleNet::HTTP.get(uri)
would work), but I prefer sending it just to be future-proof in case they'll require it.I've also added a couple of lines to the Readme to mention the two new commands.
It might be worth releasing a v1.1.1 with this fix. Sorry for the trouble 😅
/cc @dhh