Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken set_routes using query_request? #62

Closed
coleshaw opened this issue Jul 1, 2020 · 1 comment
Closed

Broken set_routes using query_request? #62

coleshaw opened this issue Jul 1, 2020 · 1 comment
Labels

Comments

@coleshaw
Copy link
Collaborator

coleshaw commented Jul 1, 2020

I'm seeing weird behavior locally with EtnaClient not being able to find the route definitions on Metis stage. I suspect it is because I changed query_request to use uri.request_uri instead of the old uri.path. This makes the OPTIONS request /?, which means no routes are returned by the Etna middleware in Metis.

From: /home/developer/.rbenv/versions/2.5.7/lib/ruby/gems/2.5.0/gems/etna-0.1.14/lib/etna/client.rb:97 Etna::Client#query_request:

    94: def query_request(type, endpoint, params={}, &block)
    95:   uri = request_uri(endpoint)
    96:   uri.query = URI.encode_www_form(params)
 => 97:   req = type.new(uri.request_uri, request_params)
    98:   request(uri, req, &block)
    99: end

[5] pry(#<Etna::Client>)> uri.request_uri
=> "/?"
[7] pry(#<Etna::Client>)> uri.path
=> "/"

I wonder if either options() should use a non-query request, or we should just make sure no trailing ? is present on a query_request with no params.

@coleshaw coleshaw added the bug label Jul 1, 2020
@coleshaw
Copy link
Collaborator Author

coleshaw commented Jul 1, 2020

Seems to work -- with a valid token! Something in the middleware must account for this already...

@coleshaw coleshaw closed this as completed Jul 1, 2020
corps added a commit that referenced this issue Aug 19, 2020
Rollbar integration, polythemus scaffolding, magma client
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant