-
Notifications
You must be signed in to change notification settings - Fork 28
feat(ruby): upgrade versions & dependencies #1067
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
Changes from 6 commits
f1a8697
de2916b
dd4271f
27e757e
14554e7
0252de4
5d2b478
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,15 +87,9 @@ def headers | |
|
||
def body | ||
if IS_RACK_V3 | ||
body = @input.read | ||
@input.rewind | ||
body | ||
read_body(@input) | ||
else | ||
@request.body.rewind | ||
content = @request.body.read | ||
@request.body.rewind | ||
|
||
content | ||
read_body(@request.body) | ||
end | ||
end | ||
|
||
|
@@ -134,5 +128,17 @@ def host_header | |
'Host' => @request.host | ||
}.compact | ||
end | ||
|
||
def read_body(io) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AndriiAndreiev what's the context behind this method? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't find any exact solutions for this, but this method seems to fix it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AndriiAndreiev can you add a test case for this? Looks good to me, but I'd love some additional confidence in our code base. |
||
return '' if io.nil? | ||
|
||
io.rewind if io.respond_to?(:rewind) | ||
content = io.read || '' | ||
io.rewind if io.respond_to?(:rewind) | ||
content | ||
rescue => e | ||
Readme::Metrics.logger.warn "Error reading request body: #{e.message}" | ||
'' | ||
end | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: might be mistaken, but I don't believe this is related to the other changes. If not, given we squash and merge commits from PRs, maybe let's move this to a separate PR so we have a more distinct commit history post-merge.