Skip to content

Commit 0873952

Browse files
committed
headers and missing test
1 parent 44be9f2 commit 0873952

File tree

4 files changed

+21
-8
lines changed

4 files changed

+21
-8
lines changed

lib/optimizely/config/proxy_config.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# frozen_string_literal: true
22

3+
# Copyright 2020, Optimizely and contributors
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
#
18+
319
module Optimizely
420
class ProxyConfig
521
attr_reader :host, :port, :username, :password

spec/config/proxy_config_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
#
4-
# Copyright 2019-2020, Optimizely and contributors
4+
# Copyright 2020, Optimizely and contributors
55
#
66
# Licensed under the Apache License, Version 2.0 (the "License");
77
# you may not use this file except in compliance with the License.

spec/config_manager/http_project_config_manager_spec.rb

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -516,17 +516,15 @@
516516
expect(Optimizely::Helpers::HttpUtils).to have_received(:make_request).with('http://awesomeurl', any_args)
517517
end
518518

519-
it 'should pass the proxy config that is passed in' do
520-
proxy_config = double(:proxy_config)
521-
519+
it 'should hide access token when printing logs' do
522520
allow(Optimizely::Helpers::HttpUtils).to receive(:make_request)
523521
@http_project_config_manager = Optimizely::HTTPProjectConfigManager.new(
524522
sdk_key: 'valid_sdk_key',
525523
datafile_access_token: 'the-token',
526-
proxy_config: proxy_config
524+
logger: spy_logger
527525
)
528526
sleep 0.1
529-
expect(Optimizely::Helpers::HttpUtils).to have_received(:make_request).with(anything, anything, anything, hash_including('Authorization' => 'Bearer the-token'), anything, proxy_config)
527+
expect(spy_logger).to have_received(:log).with(Logger::DEBUG, 'Datafile request headers: {"Content-Type"=>"application/json", "Authorization"=>"********"}').once
530528
end
531529

532530
it 'should pass the proxy config that is passed in' do

spec/helpers/http_utils_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright 2016-2017, 2019-2020, Optimizely and contributors
3+
# Copyright 2020, Optimizely and contributors
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,7 +16,6 @@
1616
#
1717
#
1818
require 'spec_helper'
19-
# require 'optimizely/helpers/http_utils'
2019
require 'optimizely/config/proxy_config'
2120

2221
describe Optimizely::Helpers::HttpUtils do

0 commit comments

Comments
 (0)