Routes can use unicode characters without causing an encoding exception on
Ruby 1.9. Fixes #81.
This commit is contained in:
parent
1e55be7285
commit
2943e9383b
|
@ -550,6 +550,7 @@ module Sinatra
|
|||
@response = Response.new
|
||||
@params = indifferent_params(@request.params)
|
||||
template_cache.clear if settings.reload_templates
|
||||
force_encoding(@request.route)
|
||||
force_encoding(@params)
|
||||
|
||||
@response['Content-Type'] = nil
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# I like coding: UTF-8
|
||||
require File.dirname(__FILE__) + '/helper'
|
||||
|
||||
# Helper method for easy route pattern matching testing
|
||||
|
@ -69,6 +70,14 @@ class RoutingTest < Test::Unit::TestCase
|
|||
assert_equal 'pass', response.headers['X-Cascade']
|
||||
end
|
||||
|
||||
it "allows using unicode" do
|
||||
mock_app do
|
||||
get('/föö') { }
|
||||
end
|
||||
get '/f%C3%B6%C3%B6'
|
||||
assert_equal 200, status
|
||||
end
|
||||
|
||||
it "overrides the content-type in error handlers" do
|
||||
mock_app {
|
||||
before { content_type 'text/plain' }
|
||||
|
|
Loading…
Reference in New Issue