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

name conflict #16

Open
nathanielrb opened this issue Oct 3, 2018 · 2 comments
Open

name conflict #16

nathanielrb opened this issue Oct 3, 2018 · 2 comments

Comments

@nathanielrb
Copy link

I found this while trying to use the Faraday http gem, and I'm not sure if the problem is Faraday's or the template's. (My Ruby knowledge isn't that deep.)

The query defined in the included SinatraTemplate::Utils gets mixed up with a query used in Faraday's internal definitions (https://github.com/lostisland/faraday/blob/88de44ebe3c40f9050553ce7c0018990b92c2f38/lib/faraday/request.rb#L48-L62)

Any ideas?

Example web.rb:

require 'faraday'

get "/faraday" do
  response = Faraday.get 'http://redpencil.io'
  log.info response
  "it worked"
end
@nvdk
Copy link
Member

nvdk commented Jul 9, 2020

after some research, this is indeed a bug in the template. This has been around for quite some time and should indeed be addressed.
Because we include the utils in a top level file all these functions become global. We should address it by including the utils inside the helpers. that way they are still available in web.rb as helpers and can be used as utils were necessary.

my main fear is that some services may depend on this (faulty) behavior where our helpers are global functions.

@erikap
Copy link
Member

erikap commented Oct 24, 2023

Since v2.14.0 the template has a flag USE_LEGACY_UTILS to disable the inclusion of the utility functions as globals. By setting USE_LEGACY_UTILS to false you can avoid the conflict on query with the Faraday gem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants