I just copied what was in the Rails middleware, but I suppose that would work. I'll add some specs to verify.