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: 64bcd93b7810fda03ae7e4ca953c89c99668b010c17f27d0f9e7feadb7ab2c34
4
- data.tar.gz: 78918e3342128184cddbe7ecaa5f71a72f906abdc9d5e0902be6f791ff84f6b9
3
+ metadata.gz: 8e0746344411dfb94b2390bb0a89ab7ec4027958b8d4a59f5ff279120610bf7a
4
+ data.tar.gz: 5641776831bf1c8fc82f43393d4dfaf6de61e5e35d76d1f56dbd3fa77d1affe7
5
5
  SHA512:
6
- metadata.gz: 3143f65cf899576de9c7ce91df6ae17efb0f0d496804e99f45e4ef00223398d1aae0278c726cc7baecfc8cd8693dd6e614db1ab9a123e3790d670c37e96e4f5d
7
- data.tar.gz: ca43fa742f06811c7c3b2bab50a539b8f022aa04fb46592baaa77a44e128ffb36db7deee302997c90e564d28ccd8c094a0fff26fbd3c4b94ede68f9f4b866f13
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
- if (name = env[rack_key]).present?
21
- env[client_key] = CallingServiceClient.new(name)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stitches
4
- VERSION = '5.1.0'
4
+ VERSION = '5.1.1.RC1'
5
5
  end
@@ -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 "NameNotFound"
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 "NameNotFound"
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 "leaves the env var nil" do
40
+ it "sets a fallback CallingServiceClient with empty name" do
41
41
  _status, result_env, _body = middleware.call(env)
42
- expect(result_env[client_key]).to be_nil
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 "leaves the env var nil" do
52
+ it "sets a fallback CallingServiceClient with empty name" do
50
53
  _status, result_env, _body = middleware.call(env)
51
- expect(result_env[client_key]).to be_nil
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stitches
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1.RC1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stitch Fix Engineering