diff --git a/src/reactor.cr b/src/reactor.cr index e28244c5..541cda06 100644 --- a/src/reactor.cr +++ b/src/reactor.cr @@ -45,11 +45,14 @@ module Mint HTTP::CompressHandler.new, websocket_handler, ]) do |context| + path = + URI.decode(context.request.path) + # Handle the request depending on the result. content_type, content = - if file = @files[context.request.path]? + if file = @files[path]? { - MIME.from_filename?(context.request.path).to_s || "text/plain", + MIME.from_filename?(path).to_s || "text/plain", file.call, } else diff --git a/src/test_runner.cr b/src/test_runner.cr index c4517fc2..c2ba9d7e 100644 --- a/src/test_runner.cr +++ b/src/test_runner.cr @@ -97,14 +97,15 @@ module Mint end @server = - HTTP::Server.new([ - websocket_handler, - ]) do |context| + HTTP::Server.new([websocket_handler]) do |context| + path = + URI.decode(context.request.path) + # Handle the request depending on the result. content_type, content = - if file = @files[context.request.path]? + if file = @files[path]? { - MIME.from_filename?(context.request.path).to_s || "text/plain", + MIME.from_filename?(path).to_s || "text/plain", file.call, } else