stitches 5.1.0 → 5.1.1.RC1
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
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8e0746344411dfb94b2390bb0a89ab7ec4027958b8d4a59f5ff279120610bf7a
|
|
4
|
+
data.tar.gz: 5641776831bf1c8fc82f43393d4dfaf6de61e5e35d76d1f56dbd3fa77d1affe7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e4654064ef560a5fab1e5fa0ff98740103e3aa0e707e86930958b1c487609ae3fd3e56649abd38ab2c38b6ca68ef8c8fc000d64f6c8a6f70a4b469aed13a98b6
|
|
7
|
+
data.tar.gz: 0dd65a08561bbd953c5811c64966dcf602743d4c949bf02e1d664b6a5fbbaee9ef52a07e0e8bca108020aaa645a48b72dc459428f805fe75cdb5c2c3d8cef888
|
|
@@ -17,9 +17,8 @@ module Stitches
|
|
|
17
17
|
header_name = Stitches.configuration.calling_service_header
|
|
18
18
|
rack_key = "HTTP_#{header_name.upcase.tr('-', '_')}"
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
end
|
|
20
|
+
name = env[rack_key].presence || ""
|
|
21
|
+
env[client_key] = CallingServiceClient.new(name)
|
|
23
22
|
end
|
|
24
23
|
|
|
25
24
|
@app.call(env)
|
data/lib/stitches/version.rb
CHANGED
|
@@ -45,7 +45,7 @@ RSpec.describe "/api/hellos", type: :request do
|
|
|
45
45
|
it "does not look up information from the database" do
|
|
46
46
|
execute_call
|
|
47
47
|
|
|
48
|
-
expect(response.body).to include "
|
|
48
|
+
expect(response.body).to include "Hello ,"
|
|
49
49
|
expect(response.body).to include "IdNotFound"
|
|
50
50
|
end
|
|
51
51
|
|
|
@@ -315,7 +315,7 @@ RSpec.describe "/api/hellos", type: :request do
|
|
|
315
315
|
it "does not save the api_client information used" do
|
|
316
316
|
execute_call
|
|
317
317
|
|
|
318
|
-
expect(response.body).to include "
|
|
318
|
+
expect(response.body).to include "Hello ,"
|
|
319
319
|
expect(response.body).to include "IdNotFound"
|
|
320
320
|
end
|
|
321
321
|
end
|
|
@@ -37,18 +37,24 @@ describe Stitches::CallingServiceMiddleware do
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
context "when the header is absent and env var is not set" do
|
|
40
|
-
it "
|
|
40
|
+
it "sets a fallback CallingServiceClient with empty name" do
|
|
41
41
|
_status, result_env, _body = middleware.call(env)
|
|
42
|
-
|
|
42
|
+
client = result_env[client_key]
|
|
43
|
+
|
|
44
|
+
expect(client).to be_a(Stitches::CallingServiceClient)
|
|
45
|
+
expect(client.name).to eq("")
|
|
43
46
|
end
|
|
44
47
|
end
|
|
45
48
|
|
|
46
49
|
context "when the header is blank" do
|
|
47
50
|
before { env["HTTP_X_STITCHFIX_CALLING_SERVICE"] = "" }
|
|
48
51
|
|
|
49
|
-
it "
|
|
52
|
+
it "sets a fallback CallingServiceClient with empty name" do
|
|
50
53
|
_status, result_env, _body = middleware.call(env)
|
|
51
|
-
|
|
54
|
+
client = result_env[client_key]
|
|
55
|
+
|
|
56
|
+
expect(client).to be_a(Stitches::CallingServiceClient)
|
|
57
|
+
expect(client.name).to eq("")
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
|