With Sinatra 4/Rack3, now requires "request.body.rewind" #1999
-
I'm always a bit fuzzy on "is this Sinatra or Rack?" I think this is Rack. but this issue came about when I upgraded to Sinatra 4 (and get Rack 3 too) So I'm running some dead simple rest services, that get JSON posts. I always just ran "request.body.read" to get the body. I've found some clients were NOT setting the content-type, so I've added a "request.body.rewind" before I do the read. I'm not reading the body in my code, so guessing something else is doing this when there isn't a content-type. So, as I don't want to try to make all my client "good players" by making them put content-type in.... is it a good rule of thumb to always do a "request.body.rewind"? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Yeah, to be sure you get the body, you need to rewind first. Note that "rack.input is no longer required to be rewindable." with Rack 3 https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md#rack-2--rack-3-compatibility |
Beta Was this translation helpful? Give feedback.
Yeah, to be sure you get the body, you need to rewind first.
Note that "rack.input is no longer required to be rewindable." with Rack 3
https://github.com/rack/rack/blob/main/UPGRADE-GUIDE.md#rack-2--rack-3-compatibility