Closed johnrees closed 8 years ago
Huh, weird. I took a quick peek at the specs and I don't see a test for this case, so could very well be a bug.
I can't reproduce this in a test Rails 4.1 app.
config/routes.rb:
api_version(module: 'V01', path: {value: 'v0.1'}, header: {name: "Accept", value: "application/vnd.url.com; version=0.1"}, default: true, defaults: {format: :json}) do
resources :foos
end
app/controllers/v01/foos_controller.rb:
class V01::FoosController < V01::BaseController
def index
render :text => "hi"
end
end
Requests:
> curl http://localhost:3000/foos
hi
> curl http://localhost:3000/v0.1/foos
hi
> curl -H "Accept: application/vnd.url.com; version=0.1" http://localhost:3000/v0.1/foos
hi
@johnrees what version of Rails are you using? Are you passing anything else in the Accept
header besides the version string when you make the request that results in a 404?
Closing due to radio silence. Re-open if @johnrees gets back to us on this one.
I'll submit a failing spec for this if other people have experienced it?
If I have this in my routes -
I can access these URLs
url.com/v0.1/things/1
url.com/things/1 { Accept: "application/vnd.url.com; version=0.1" }
but if I try to use both strategies and submit the header with the path
url.com/v0.1/things/1 { Accept: "application/vnd.url.com; version=0.1" }
I get a 404. Did I miss something?