Skip to content

Commit 3c97b4c

Browse files
authored
Add support for setting default headers on http-opts (#298)
* Add support for setting default headers on http-ots * Update READ.me links * commit suggestion, thanks --------- Co-authored-by: Megan Rantz <./dev infra>
1 parent f57e996 commit 3c97b4c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ end
196196
If you see something that could be done better or would like
197197
to help out in the development of this code please feel free to clone the
198198
'git' repository and send me patches:
199-
`git clone git://github.com/zenchild/Viewpoint.git`
199+
`git clone https://github.com/WinRb/Viewpoint.git`
200200
or add an issue on GitHub:
201-
http://github.com/zenchild/Viewpoint/issues
201+
https://github.com/WinRb/Viewpoint/issues
202202

203203
Cheers!

lib/ews/connection.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ class Viewpoint::EWS::Connection
2222
include Viewpoint::EWS
2323

2424
attr_reader :endpoint
25+
@@supported_httpclient_opts = %i[agent_name default_header]
26+
2527
# @param [String] endpoint the URL of the web service.
2628
# @example https://<site>/ews/Exchange.asmx
27-
# @param [Hash] opts Misc config options (mostly for developement)
29+
# @param [Hash] opts Misc config options (mostly for development)
2830
# @option opts [Fixnum] :ssl_verify_mode
2931
# @option opts [Fixnum] :receive_timeout override the default receive timeout
3032
# seconds
@@ -34,11 +36,9 @@ class Viewpoint::EWS::Connection
3436
# @option opts [String] :user_agent the http user agent to use in all requests
3537
def initialize(endpoint, opts = {})
3638
@log = Logging.logger[self.class.name.to_s.to_sym]
37-
if opts[:user_agent]
38-
@httpcli = HTTPClient.new(agent_name: opts[:user_agent])
39-
else
40-
@httpcli = HTTPClient.new
41-
end
39+
40+
httpclient_opts = opts.slice(*@@supported_httpclient_opts)
41+
@httpcli = HTTPClient.new(**httpclient_opts)
4242

4343
if opts[:trust_ca]
4444
@httpcli.ssl_config.clear_cert_store

0 commit comments

Comments
 (0)