diff --git a/HISTORY.md b/HISTORY.md index f17e3ffd..cc5f16be 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -30,6 +30,9 @@ The following were removed as `fields` since their sublist class is not yet impl * Add `update` action to `File` records (#544) * Expose `errors` after calls to `delete` action (#545) * Add `update_list` action where missing on supported item records (#546) +* Add `proxy` attribute to `NetSuite::Configuration` to set a proxy used by the savon client (#547) + +### Fixed * Ignore `after_submit_failed` status details (>= 2018.2) when collating errors in add action (#550) * Add `NullFieldList` to `SalesOrder` (#552) * Add thread safety to NetSuite configuration and utilities (#549) diff --git a/lib/netsuite/configuration.rb b/lib/netsuite/configuration.rb index 0eaf0ae6..85b36210 100644 --- a/lib/netsuite/configuration.rb +++ b/lib/netsuite/configuration.rb @@ -31,8 +31,8 @@ def connection(params={}, credentials={}, soap_header_extra_info={}) logger: logger, log_level: log_level, log: !silent, # turn off logging entirely if configured - proxy: proxy, }.update(params)) + client.globals.proxy(proxy) if proxy cache_wsdl(client) return client end diff --git a/spec/netsuite/configuration_spec.rb b/spec/netsuite/configuration_spec.rb index 04e06094..9d5f9ee8 100644 --- a/spec/netsuite/configuration_spec.rb +++ b/spec/netsuite/configuration_spec.rb @@ -519,13 +519,21 @@ expect(config.proxy).to be_nil end + it 'does not pass in nil proxy to savon' do + connection = config.connection + + expect(connection.globals.include?(:proxy)).to eql(false) + end + it 'can be set with proxy=' do config.proxy = "https://my-proxy" expect(config.proxy).to eql("https://my-proxy") # ensure no exception is raised - config.connection + connection = config.connection + + expect(connection.globals.include?(:proxy)).to eql(true) end it 'can be set with proxy(value)' do