ddy_remote_resource 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/lib/remote_resource/request.rb +1 -0
- data/lib/remote_resource/version.rb +1 -1
- data/spec/lib/remote_resource/request_spec.rb +20 -1
- data/spec/lib/remote_resource/version_spec.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a258ef2eff87f5be59c4093c6828fc2e0731690
|
4
|
+
data.tar.gz: 7f57020b0b01dad3bdb83f9de6f065e8c9fbf3c4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95d6b936bdbb2f51688872015867a5f8f5adf5c825ef75c73f451717805284c934ceeb2e4fb2f0de44b622628690ad9757662b0854e0a24f321385060de7b8d2
|
7
|
+
data.tar.gz: 52d4ec2f67b9be0f016c07d9471ac9451b6df1bb873f6a071df23453932ddbe861a6263eb60a72a61c100e64feddb37978f06f0c428296349b3181b15869760f
|
data/Gemfile
CHANGED
@@ -3,4 +3,4 @@ source 'https://rubygems.org'
|
|
3
3
|
# Specify your gem's dependencies in remote_resource.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem 'webmock',
|
6
|
+
gem 'webmock', git: 'https://github.com/JanDintel/webmock.git', branch: 'feature/ignore-json-keys-order'
|
@@ -106,6 +106,7 @@ module RemoteResource
|
|
106
106
|
def conditional_headers
|
107
107
|
headers = {}
|
108
108
|
headers = headers.merge(DEFAULT_CONTENT_TYPE) if body.present?
|
109
|
+
headers = headers.merge({ 'X-Request-Id' => Thread.current[:request_id] }) if Thread.current[:request_id].present?
|
109
110
|
headers
|
110
111
|
end
|
111
112
|
|
@@ -528,8 +528,9 @@ RSpec.describe RemoteResource::Request do
|
|
528
528
|
end
|
529
529
|
|
530
530
|
context 'when conditional_headers are present' do
|
531
|
+
let(:http_action) { 'post' }
|
532
|
+
|
531
533
|
context 'when a body is present' do
|
532
|
-
let(:http_action) { 'post' }
|
533
534
|
let(:expected_headers) do
|
534
535
|
{ 'Accept' => 'application/json', 'User-Agent' => "RemoteResource #{RemoteResource::VERSION}", 'Content-Type' => 'application/json' }
|
535
536
|
end
|
@@ -538,6 +539,24 @@ RSpec.describe RemoteResource::Request do
|
|
538
539
|
expect(request.headers).to eql expected_headers
|
539
540
|
end
|
540
541
|
end
|
542
|
+
|
543
|
+
context 'when Thread.current[:request_id] is present' do
|
544
|
+
before do
|
545
|
+
Thread.current[:request_id] = 'CASCADING-REQUEST-ID'
|
546
|
+
end
|
547
|
+
|
548
|
+
after do
|
549
|
+
Thread.current[:request_id] = nil
|
550
|
+
end
|
551
|
+
|
552
|
+
let(:expected_headers) do
|
553
|
+
{ 'Accept' => 'application/json', 'User-Agent' => "RemoteResource #{RemoteResource::VERSION}", 'Content-Type' => 'application/json', 'X-Request-Id' => 'CASCADING-REQUEST-ID' }
|
554
|
+
end
|
555
|
+
|
556
|
+
it 'returns the default headers with the X-Request-Id header' do
|
557
|
+
expect(request.headers).to eql expected_headers
|
558
|
+
end
|
559
|
+
end
|
541
560
|
end
|
542
561
|
end
|
543
562
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddy_remote_resource
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jan van der Pas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|