stitches 5.1.0.RC1 → 5.1.0.RC2
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 +4 -4
- data/README.md +1 -1
- data/lib/stitches/calling_service_name.rb +2 -2
- data/lib/stitches/version.rb +1 -1
- data/spec/calling_service_name_spec.rb +25 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74c049e2d66d366adce255f0fd8d41b6eb0e121669225b1fbce4dbd8ccb19b10
|
|
4
|
+
data.tar.gz: 8d8b6b8d5cc2e57b4e21a5a9097ccd14b462087c82ce6c30cfd2e6b4617c49c5
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 343c659a9e37f29caadad39b2c0d66496f164efea60e9a499daec8bb156fd5e90801af304d2bc0ac307c00ee4934b400ea4f22db4e7a996b9d7d114751a5a55c
|
|
7
|
+
data.tar.gz: dfaa3c860b35fbbbd44ba3c99d4ac1a1ce820de42393ddaa9d93cb12fb0062ad03d14cfb2a7f0ab64dfe5fa83ecd72271c30aa222923ba9fc5cecb35501d8311
|
data/README.md
CHANGED
|
@@ -72,7 +72,7 @@ end
|
|
|
72
72
|
|
|
73
73
|
1. `X-StitchFix-Calling-Service` request header (preferred)
|
|
74
74
|
2. `api_client&.name` — the stitches-authenticated ApiClient (works when API keys are enabled)
|
|
75
|
-
3. `"
|
|
75
|
+
3. `""` (empty string) — fallback when neither is available
|
|
76
76
|
|
|
77
77
|
This is backwards compatible. When `disable_api_key_support` is false, the
|
|
78
78
|
stitches middleware still populates `api_client`, so the fallback returns the
|
data/lib/stitches/version.rb
CHANGED
|
@@ -50,15 +50,37 @@ describe Stitches::CallingServiceName do
|
|
|
50
50
|
|
|
51
51
|
context "when neither header nor api_client is present" do
|
|
52
52
|
it "returns 'unknown'" do
|
|
53
|
-
expect(fake_controller.calling_service_name).to eq("
|
|
53
|
+
expect(fake_controller.calling_service_name).to eq("")
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
context "when api_client is nil" do
|
|
58
58
|
let(:fake_api_client) { nil }
|
|
59
59
|
|
|
60
|
-
it "returns
|
|
61
|
-
expect(fake_controller.calling_service_name).to eq("
|
|
60
|
+
it "returns empty string" do
|
|
61
|
+
expect(fake_controller.calling_service_name).to eq("")
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context "when api_client method is not defined" do
|
|
66
|
+
let(:fake_controller) {
|
|
67
|
+
req = fake_request
|
|
68
|
+
Object.new.tap { |c|
|
|
69
|
+
c.extend(described_class)
|
|
70
|
+
c.define_singleton_method(:request) { req }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
it "returns empty string" do
|
|
75
|
+
expect(fake_controller.calling_service_name).to eq("")
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
context "and header is present" do
|
|
79
|
+
let(:headers) { {"X-StitchFix-Calling-Service" => "fixops"} }
|
|
80
|
+
|
|
81
|
+
it "returns the header value" do
|
|
82
|
+
expect(fake_controller.calling_service_name).to eq("fixops")
|
|
83
|
+
end
|
|
62
84
|
end
|
|
63
85
|
end
|
|
64
86
|
end
|