ruby-grape / grape

An opinionated framework for creating REST-like APIs in Ruby.
http://www.ruby-grape.org
MIT License
9.88k stars 1.22k forks source link

"prefix" no longer looks at a trailing slash #1741

Open thatsanicehat opened 6 years ago

thatsanicehat commented 6 years ago

After recently upgrading to Grape 1.0.x, it seems that

prefix 'api'

gets a bit too greedy in which routes it intercepts.

When using something like

mount ApiClass::Base => '/'
get '/*params/'`

where, the "prefix" is defined within the ApiClass::Base, a route such as domain/apiary previously used the Rails router. Instead, that route is now intercepted with Grape.

thatsanicehat commented 6 years ago

This seems to stem from a change introduced in https://github.com/ruby-grape/grape/pull/1517/files#diff-1a2141f1143a454a12c8400e0dea79d4, which alters the default behavior of anchoring.

This differs from the documentation at https://github.com/ruby-grape/grape#anchoring

dblock commented 6 years ago

This looks legit, care to write some failing specs first?