Conversation
|
Hi @joshbuddy can you take a look at this PR? thanks so much ;) |
|
I've just landed here, trying to understand the reason of the hanami warnings. I also read http://stackoverflow.com/a/34275638/123527, and specifically
This is extremely sad, and confusing! |
|
@cllns @AlfonsoUceda FYI there is also another solution, that doesn't require to bring in the Addressable dependency. Simply replace: class HttpRouter
class Request
attr_accessor :path, :params, :rack_request, :extra_env, :continue, :passed_with, :called
attr_reader :acceptable_methods
alias_method :rack, :rack_request
alias_method :called?, :called
def initialize(path, rack_request)
@rack_request = rack_request
@path = URI.unescape(path).split(/\//)to The relevant line is @path = URI::DEFAULT_PARSER.unescape(path).split(/\//)This is the current implementation of def unescape(*arg)
warn "#{caller(1)[0]}: warning: URI.unescape is obsolete" if $VERBOSE
DEFAULT_PARSER.unescape(*arg)
endWhy I think this is a reasonable (perhaps not the best, but reasonable) solution:
|
|
@weppos thanks for bringing up that solution I think it's good for us and we could create a PR in hanami/controller to overwrite the initializer, what do you think? |
|
I'm not very familiar with how hanami/controller deals with the router. I would not recommend to override an entire initializer for the long term solution, but given this library seems to be quite static, it may be a temporary solution. /cc @jodosha |
|
Seeing the http_router warnings in test output in a Hanami app. Anything I can do to help get this one in? |
Addresses most of #44.
Fixing
warning: URI.escape is obsoleteandwarning: URI.unescape is obsoleterequired adding a dependency, onAddressable. I hope that's OK!All the tests pass (except for
examples/static/config.rudoesn't run for me, regardless of these changes, see: #46).Note: this doesn't fix all the Ruby warnings in this project, but rather the ones that
hanami-routerhits in its test suite. I tried to fix others, but they weren't easy fixes (instance_evalredefining a method). To run the tests with warnings enabled, you can do:RUBYOPT=w bundle exec rake testAlso, I couldn't fix one of the warnings that
hanami-routerhits:lib/http_router/route_helper.rb:99: warning: assigned but unused variable - params, because the local variable is referenced in theevalcall a couple lines down, in one of the tests :/