Giter Club home page Giter Club logo

Comments (4)

dblock avatar dblock commented on June 4, 2024 1

Found the issue, rack/rack#1972. Adding use Rack::RewindableInput::Middleware fixed the issue for me, so would downgrading to Rack 2.x.

require_relative 'api'
use Rack::RewindableInput::Middleware
run API::Root

We should do something about this in Grape. Would you like to help @andrius? We have https://github.com/ruby-grape/grape/tree/master/spec/integration/rack/v3 and https://github.com/ruby-grape/grape/blob/master/gemfiles/rack_3_0.gemfile, but we're not catching this error. The first thing to figure out is how to reproduce it in CI, then we can see whether we should just recommend including this middleware manually, or more likely have to write some code to include it when Rack version is >= 3.0.

from grape.

dblock avatar dblock commented on June 4, 2024

This is caused by lack of rewind on the input in Rack. Typically that would extend https://github.com/rack/rack/blob/main/lib/rack/rewindable_input.rb, but it looks like Rack::Lint::Wrapper::InputWrapper doesn't have that. What is the actual setup you have that makes the content that type? Try building a minimal repro?

from grape.

andrius avatar andrius commented on June 4, 2024

Thank you. I've included minimal example in this gist: https://gist.github.com/andrius/50e2965a9b0936a7c76f9d7f77bdc2a7

To run:

docker compose build && docker compose run --rm --interactive --service-ports api

To test:

curl -X POST \
  'http://localhost:3000/v1/users' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{"name": "foo", "lastname": "bar", "email": "[email protected]", "telephone": "+1234567890", "role": "user"}'

from grape.

andrius avatar andrius commented on June 4, 2024

Your suggestion with use Rack::RewindableInput::Middleware helped and API start working!

Would you like to help @andrius?

I will try but it will take time. Just check'ed the GitHub workflows

from grape.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.