intridea/grape — Issue #88: How to test with header-based API versioning?
Author: ahhrrr
Created: 2011-12-01 18:28:56+00:00
State: open

Hi,

I'm interested in using the new header-based API versioning, but I'm unsure how to test this using the suggested RSpec Request specs. The normal RSpec way of setting HTTP headers is to set the header on the rack request object, like `request.env["HTTP_ACCEPT"] = "application/vnd.twitter-v1+json"`.

But RSpec request tests don't allow you to set the HTTP header in this way – the request object is nil. Any ideas?