sitehub 0.4.6 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fb7cd90f333ade307a9dd901fb5922709263f78a
4
- data.tar.gz: f843541b0caa8a76238aa299158c84a12616bfd8
3
+ metadata.gz: 04363e00e3336d8455b4cb2c9d4eb4fc9740b8b5
4
+ data.tar.gz: 6016da732dd7cdb35e7dbe0a1d74697f98dc9557
5
5
  SHA512:
6
- metadata.gz: 0f0ea72647bbab0b92f166ade2d2f48eb6621c335bcc0c8ac711017dbb24540e40ced8327e7e67204f5a40439e318b840a27d76bdc30cb5eb73eb1b3a381be33
7
- data.tar.gz: cafdd5cae62c9a8036adc64a7ab567ede50ef287f25983039374dd7bca7b9db3da7cffbd2d4d3fb8d9e8e0575d7962d462b2534f054d583823da361136777317
6
+ metadata.gz: 96eaea637b18d9e272b526d664a9d5c748d910a8c59de339b2f091df2a3e693f3cbf5363cdf0f62f1c8831f5449fb01c1f647c66b0ecd63bd9b181db0b025ab4
7
+ data.tar.gz: 5165e6d91e40ac2945fd881efe73d69f4addd303bed5d35c87bee949343fd05f3231065f2f88a2bc25cef0154a0af548705b5665e39b9d38500a5cc5a15e66b4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sitehub (0.4.6)
4
+ sitehub (0.4.7)
5
5
  em-http-request
6
6
  em-synchrony
7
7
  faraday
@@ -10,7 +10,8 @@ class SiteHub
10
10
  end
11
11
 
12
12
  def call(env)
13
- env[RackHttpHeaderKeys::TRANSACTION_ID] ||= UUID.generate(:compact)
13
+ request = env[REQUEST]
14
+ request.headers[HttpHeaderKeys::TRANSACTION_ID] ||= UUID.generate(:compact)
14
15
  @app.call env
15
16
  end
16
17
  end
@@ -1,3 +1,3 @@
1
1
  class SiteHub
2
- VERSION = '0.4.6'.freeze
2
+ VERSION = '0.4.7'.freeze
3
3
  end
@@ -3,26 +3,29 @@ require 'sitehub/middleware/transaction_id'
3
3
  class SiteHub
4
4
  module Middleware
5
5
  describe TransactionId do
6
- let(:transaction_id) { Constants::RackHttpHeaderKeys::TRANSACTION_ID }
6
+ let(:transaction_id) { Constants::HttpHeaderKeys::TRANSACTION_ID }
7
7
  subject do
8
8
  described_class.new(proc {})
9
9
  end
10
+
11
+ let(:request) { Request.new(env: {}) }
12
+ let(:env) { { REQUEST => request } }
13
+
10
14
  it 'adds a unique identifier to the request' do
11
15
  uuid = UUID.generate(:compact)
12
16
  expect(UUID).to receive(:generate).with(:compact).and_return(uuid)
13
- env = {}
14
17
  subject.call(env)
15
18
 
16
- expect(env[transaction_id]).to eq(uuid)
19
+ expect(request.headers[transaction_id]).to eq(uuid)
17
20
  end
18
21
 
19
22
  context 'transaction id header already exists' do
20
23
  it 'leaves it intact' do
21
24
  expect(UUID).to_not receive(:generate)
22
- env = { transaction_id => :exiting_id }
25
+ request.headers[transaction_id] = :existing_id
23
26
  subject.call(env)
24
27
 
25
- expect(env[transaction_id]).to eq(:exiting_id)
28
+ expect(request.headers[transaction_id]).to eq(:existing_id)
26
29
  end
27
30
  end
28
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitehub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.6
4
+ version: 0.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ladtech