savonrb / httpi

Common interface for Ruby's HTTP clients
http://httpirb.com
MIT License
301 stars 151 forks source link

How can we define the environment for mounted rails apps #207

Closed AJFaraday closed 2 months ago

AJFaraday commented 4 years ago

Sorry if this is the wrong place to ask this, but I can't find any documentation about it.

I'm mounting an app with the HTTPI Rack adapter:

::HTTPI.adapter = :rack
::HTTPI::Adapter::Rack.mount 'app', ::MyApp::Application

However, it's starting up in development mode, which may be the root of a problem.

I've tried a few different approaches to set the environment before mounting

`export RAILS_ENV=production`
Rails.env = 'production'
Rails.env = 'PRODUCTION'

None of these seem to have worked so far.

rogerleite commented 4 years ago

Hi @AJFaraday

The short answer is I don't know how to set the environment for your case. The only documentation this adapter has is the PR that implemented: https://github.com/savonrb/httpi/pull/75.

What's your root problem? What do you want to do with this? The idea of this adapter is using to test only I think.

Hope that helps.

AJFaraday commented 4 years ago

@rogerleite The issue is occurring in testing, when a value in one of the arguments contains a % symbol.

/home/biorails/.rvm/rubies/ruby-2.2.10/lib/ruby/2.2.0/uri/common.rb:382:in `decode_www_form_component': invalid %-encoding ("1.0" encoding="ISO-8859-1"?><en

It doesn't seem to be reaching the controller, the call doesn't hit the logs.

It's fine when I pass the exact XML to a production server there's no error.


The environment was the only difference I could see.

pcai commented 2 months ago

@AJFaraday sorry - I think you'll have better luck trying to ask this in a rails-specific forum. The rack adapter is very simple and doesn't really have any configuration options