Skip to content

Routing priority issue in Grape v2.1.0 when using with rails #2452

Closed
@eiskrenkov

Description

@eiskrenkov

Hello, everyone! When upgrading to grape v2.1.0 we've encountered an issue with routing. I created a sample rails new repo for demo purposes - https://github.com/eiskrenkov/grape-routing-issue-demo

Issue

I'm mounting grape API in rails routes at the top of the file

Rails.application.routes.draw do
  mount Twitter::Api => '/'

  get "up" => "rails/health#show", as: :rails_health_check
end

When i'm doing GET http://localhost:3000/up request in grape v2.0.0 it returns response correctly, but in grape v2.1.1 i'm getting 404 error. It seems like something was changed in route prioritising, if nothing matches grape's routes it doesn't continue the journey

Steps to reproduce

  1. (export SHOULD_WORK=true; bundle; bundle exec rails s)

will use grape v2.0.0 and will respond to http://localhost:3000/up correctly

  1. (export SHOULD_WORK=false; bundle; bundle exec rails s)

will use grape v2.1.0 and respond with 404

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions