Skip to content

Conversation

alexanderadam
Copy link
Contributor

@alexanderadam alexanderadam commented Oct 21, 2025

Soooo, I might have missed something here but the way I see this is, that PR #1893 introduced the behaviour seen in #2576.

And the problem to be tackled was different than what was implemented.
According to the Rack Spec, a Rack app only needs to be

a Ruby object that responds to call. It takes exactly one argument, the environment (representing an HTTP request) and returns a non-frozen Array of exactly three elements: the status, the headers, and the body (representing an HTTP response).

Therefore having Grape::API.call delegating to base_instance.call should be enough.

Howeveeeeeer, when using Rack::Test with def app returning a Grape::API class directly (e.g., API::V1::Ping), tests would naturally fail with 404.

So to me this looks like the fix with d29eb79 was a bit weird and introduced that bug in #2576. 🤔

But I could also be totally wrong with my understanding here.
And I'm therefore open to any corrections and learnings.

PS: I'm looking for a new adventure in case anybody is looking to hire or work with a Ruby/Rails/Crystal dev
PPS: would you be so kind and add the hacktoberfest-accepted label to this issue in case you find that PR helpful? 🥺

@dblock dblock requested a review from ericproulx October 21, 2025 13:35
@dblock
Copy link
Member

dblock commented Oct 21, 2025

@alexanderadam Thanks! Fix CI/CHANGELOG and I'll take a close look - @ericproulx wdyt?

@alexanderadam alexanderadam force-pushed the fix/avoid_multiple_mounts_pollution branch from 2cd43bb to 1856ff9 Compare October 21, 2025 13:39
@alexanderadam
Copy link
Contributor Author

@alexanderadam Thanks! Fix CI/CHANGELOG

done 🙂

@alexanderadam alexanderadam force-pushed the fix/avoid_multiple_mounts_pollution branch from 1856ff9 to 0660ae7 Compare October 21, 2025 16:10
Copy link
Member

@dblock dblock left a comment

Choose a reason for hiding this comment

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

This looks correct to me. Let's ask @bogdan and @myxoh to also look at this as they authored the linked issues/PRs.

@alexanderadam alexanderadam force-pushed the fix/avoid_multiple_mounts_pollution branch from 0660ae7 to 68a36c8 Compare October 21, 2025 19:35
@bogdan
Copy link

bogdan commented Oct 22, 2025

That's fine to me if it fixes the issue. The test looks perfectly right.

@ericproulx
Copy link
Contributor

Looks good to me 👍 thank you

@ericproulx
Copy link
Contributor

@alexanderadam could you mount your api multiple times and try with a configuration.

@dblock
Copy link
Member

dblock commented Oct 22, 2025

@alexanderadam see my comment on breaking up specs, too, please.

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.

4 participants