Skip to content

Conversation

@rahearn
Copy link

@rahearn rahearn commented Jun 13, 2024

After moving to rack 3.1.x, last_request.env["rack.input"] is returning nil on get requests. This will safely deal with that situation, replacing the return value with an empty string.

@akostadinov
Copy link

Can this be merged? Can a new version be released?

@vladimirtcats
Copy link

+1, can't upgrade rack because of this issue

1 similar comment
@Ivanov-Anton
Copy link

+1, can't upgrade rack because of this issue

@bf4
Copy link
Contributor

bf4 commented Mar 18, 2025

interesting. Thanks for reporting this. We need to get CI passing too

@Krisztian-Molnar
Copy link

So you couldn't get CI passing for months? Everybody needs this fix to make it work with rack 3.1.x and this PR was opened 1 year ago...

@bf4
Copy link
Contributor

bf4 commented Jun 4, 2025

That is correct. So it goes in open source at times

@bf4
Copy link
Contributor

bf4 commented Jul 24, 2025

CI is passing now. This PR is related to #541

@codersquirrelbln
Copy link

Any chance of this getting merged soon? 🙏 ☺️

@codersquirrelbln
Copy link

@rahearn, are you available to take a stab at the merge conflicts? That would be amazing and I would really appreciate it 🎉

@rahearn
Copy link
Author

rahearn commented Nov 7, 2025

It looks like #528 fixed this issue (via return "" unless input), I just switched my app from my branch to master and tests are passing still. I'm going to close this as unnecessary.

@rahearn rahearn closed this Nov 7, 2025
@codersquirrelbln
Copy link

codersquirrelbln commented Nov 10, 2025

@rahearn, thank you for your response. I have the newest version of the gem, and the issue you linked, did not fix my error, unfortunately.
In client_base.rb the code is still

def read_request_body
      input = last_request.env["rack.input"]
      return "" unless input
      input.rewind if input.respond_to?(:rewind)
      input.read
    end

This PR above changes it to:

def read_request_body
  input = last_request.env["rack.input"]
  input&.rewind
  input&.read || ""
end

Maybe I am reading it wrong. I appreciate your time to respond and look into this! 🙏

P.S.: Patching it like this in my codebase does work.

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.

8 participants