Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly require date for DateTime #844

Merged
merged 1 commit into from Feb 7, 2019

Conversation

nickpresta
Copy link

Description

This change fixes an issue where it seems Farday is using DateTime, specifically for retry functionality, without requiring it. This leads to a NameError. Without explicitly requiring date, retry functionality fails with the following error:

NameError: uninitialized constant Faraday::Request::Retry::DateTime
from /Users/npresta/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/faraday-0.15.4/lib/faraday/request/retry.rb:194:in `calculate_retry_after'
Caused by Faraday::RetriableResponse:
from /Users/npresta/.rbenv/versions/2.4.4/lib/ruby/gems/2.4.0/gems/faraday-0.15.4/lib/faraday/request/retry.rb:129:in `block in call'

It looks like this was introduced in 6ddf9c3 Perhaps the testing environment, or IRB, automatically requires date, but if you just run this in Ruby directly:

$ ruby -e 'DateTime.rfc2822("hi")'
-e:1:in `<main>': uninitialized constant DateTime (NameError)

Ruby version: 2.4.4

Additional Notes

This seems like a straightforward bugfix, but likely doesn't impact many people (no open issues, no Google searches) so I would imagine most Ruby apps have date imported somewhere.

Copy link
Member

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch!
This has probably impacted few people because Ruby Frameworks (e.g. Rails, Sinatra) will include that for you.
Anyway it's a Ruby core library and doesn't require any external gem, so this change shouldn't break anyone's code.

@iMacTia iMacTia merged commit 6f2ae82 into lostisland:master Feb 7, 2019
@nickpresta nickpresta deleted the patch-1 branch February 7, 2019 19:01
@technoweenie technoweenie mentioned this pull request Jun 25, 2019
3 tasks
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.

None yet

2 participants