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
|
@response = Response.new
|
||||||
@params = indifferent_params(@request.params)
|
@params = indifferent_params(@request.params)
|
||||||
template_cache.clear if settings.reload_templates
|
template_cache.clear if settings.reload_templates
|
||||||
|
force_encoding(@request.route)
|
||||||
force_encoding(@params)
|
force_encoding(@params)
|
||||||
|
|
||||||
@response['Content-Type'] = nil
|
@response['Content-Type'] = nil
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# I like coding: UTF-8
|
||||||
require File.dirname(__FILE__) + '/helper'
|
require File.dirname(__FILE__) + '/helper'
|
||||||
|
|
||||||
# Helper method for easy route pattern matching testing
|
# Helper method for easy route pattern matching testing
|
||||||
|
@ -69,6 +70,14 @@ class RoutingTest < Test::Unit::TestCase
|
||||||
assert_equal 'pass', response.headers['X-Cascade']
|
assert_equal 'pass', response.headers['X-Cascade']
|
||||||
end
|
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
|
it "overrides the content-type in error handlers" do
|
||||||
mock_app {
|
mock_app {
|
||||||
before { content_type 'text/plain' }
|
before { content_type 'text/plain' }
|
||||||
|
|
Loading…
Reference in New Issue