faraday-hot_mock 0.6.1 → 0.6.2

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: c7d36fd4d278626550e98a108fb9878190fa829ff10216806897bbcf8601ef20
4
- data.tar.gz: 88f1cc037062e2581de849d0043a75f17ef23e5cdbfdb6eabd5311ce90ce0136
3
+ metadata.gz: 8404a4aacd47d61fd57da47cc113f0aacaba5ecf503e62241887f7f816914b94
4
+ data.tar.gz: 1b4e147425ffb319a4e162af72555f8780d555b274b0e7c8925c165cc659ed0f
5
5
  SHA512:
6
- metadata.gz: 2757eff042477296cfc296c8a4c0c2bcab0dd9d411d8406b6147252510ed2cf1a8063d97f2fe754c3195f610ee6e24678766f96a40b0f49f6fc3bcf5555362bb
7
- data.tar.gz: c2e8063cd973a938240a2b2835955c80137f50e2f3e4874cebcb9f65a9aa3afacf537a4ef42e19cddb096b3aedf5fceb180458ced84fc3e901a3cb98595da186
6
+ metadata.gz: 928f88000b9403ecce898bccdc92d754da669c39be00d29b652dc6ffc6627975a53ecd2f3485eb62aef04b5b2eea2425e12a07cef56e3f2590efe056465c206b
7
+ data.tar.gz: 120492f759010d866e222c5514295ec2d4426b97766fb3d806c47f982b40810ee7aadada1c13a6760425473de85288d95486b2086a5ce12ac0e8c23045b2b6bc
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
2
  module HotMock
3
- VERSION = "0.6.1"
3
+ VERSION = "0.6.2"
4
4
  end
5
5
  end
@@ -72,14 +72,16 @@ module Faraday
72
72
  mocks.find { |entry| entry["method"].to_s.upcase == method.to_s.upcase && Regexp.new(entry["url_pattern"]).match?(url.to_s) } || false
73
73
  end
74
74
 
75
- def record(method:, url:, into_scenario: nil)
75
+ def record(method:, headers: {}, url:, body: {}, into_scenario: nil)
76
76
  self.scenario = into_scenario if into_scenario.present?
77
77
 
78
78
  return false if mocked?(method:, url:)
79
79
 
80
- faraday = Faraday.new
80
+ faraday = Faraday.new(
81
+ headers:,
82
+ )
81
83
 
82
- response = faraday.send(method.downcase.to_sym, url)
84
+ response = faraday.send(method.downcase.to_sym, url, body)
83
85
 
84
86
  FileUtils.mkdir_p(hot_mock_dir)
85
87
  FileUtils.touch(hot_mock_file)
@@ -90,7 +92,7 @@ module Faraday
90
92
  "method" => method.to_s.upcase,
91
93
  "url_pattern" => url.to_s,
92
94
  "status" => response.status,
93
- "headers" => response.headers.to_h.merge(HEADERS[:recorded] => Time.now.utc.iso8601),
95
+ "headers" => response.headers.to_h.merge(HEADERS[:recorded] => Time.now.utc.iso8601, HEADERS[:mocked] => "true"),
94
96
  "body" => response.body
95
97
  }
96
98
 
@@ -114,7 +116,7 @@ module Faraday
114
116
  "method" => method.to_s.upcase,
115
117
  "url_pattern" => url.to_s,
116
118
  "status" => response.status,
117
- "headers" => response.headers.to_h.merge(HEADERS[:recorded] => Time.now.utc.iso8601, "x-hot-mock" => "true"),
119
+ "headers" => response.headers.to_h.merge(HEADERS[:recorded] => Time.now.utc.iso8601, HEADERS[:mocked] => "true"),
118
120
  "body" => response.body
119
121
  }
120
122
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-hot_mock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sean Hogge