webmock 3.19.1 → 3.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +35 -1
- data/README.md +6 -0
- data/lib/webmock/http_lib_adapters/em_http_request_adapter.rb +1 -1
- data/lib/webmock/http_lib_adapters/http_rb/request.rb +15 -5
- data/lib/webmock/http_lib_adapters/httpclient_adapter.rb +4 -4
- data/lib/webmock/http_lib_adapters/typhoeus_hydra_adapter.rb +16 -2
- data/lib/webmock/rack_response.rb +3 -1
- data/lib/webmock/response.rb +1 -1
- data/lib/webmock/util/headers.rb +5 -6
- data/lib/webmock/version.rb +1 -1
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 824b2fb63d4d765d0aabc45c9b9aefe1c686021b2d2268af07cc584692f763c6
|
4
|
+
data.tar.gz: '05579b98d43c99f9adc01a7d7c1f991f9c254b958b5df340f458d127cd15c291'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5666ec34890824cafb1a60c5ba631d3054c72d6a587308ae58c48f7f46754a3286e75f089b49f71c68857afee8bfc40a093558cecb38af80b2fd6e3faee95f69
|
7
|
+
data.tar.gz: 62488bf922c53c46a76699c84ba0d42bcc6156bd82c67064bdd595bfbc9650879df813c6cb7c61db0ef99f80d831da388a2ea84f359e3b47f8c18d4d4310cba0
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,45 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
# 3.
|
3
|
+
# 3.21.0
|
4
|
+
|
5
|
+
* Don't use deprecated Rack::VERSION for Rack >= 3
|
6
|
+
|
7
|
+
Thanks to [Étienne Barrié](https://github.com/etiennebarrie)
|
8
|
+
|
9
|
+
* Updated HTTPClient adapter, to build request signature using the URI after filters have been applied.
|
10
|
+
|
11
|
+
Thanks to [Matt Brown](https://github.com/mattbnz)
|
12
|
+
|
13
|
+
# 3.20.0
|
14
|
+
|
15
|
+
* Optimised EmHttpRequestAdapter performance.
|
16
|
+
|
17
|
+
Thanks to [Ricardo Trindade](https://github.com/RicardoTrindade)
|
18
|
+
|
19
|
+
* Removed runtime dependency on base64.
|
20
|
+
|
21
|
+
Thanks to [Earlopain](https://github.com/Earlopain)
|
22
|
+
|
23
|
+
* Typhoeus::Response objects constructed from stubbed responses now have all timing attributes set to 0.0.
|
24
|
+
|
25
|
+
Thanks to [James Brown](https://github.com/Roguelazer)
|
26
|
+
|
27
|
+
* Optimised WebMock::Util::Headers by removing redundant freeze invocations.
|
28
|
+
|
29
|
+
Thanks to [Kazuhiro NISHIYAMA](https://github.com/znz)
|
30
|
+
|
31
|
+
* The default stubbed response body, which is an empty String, is unfrozen.
|
32
|
+
|
33
|
+
* When building signatures of requests made by http.rb, the request body encoding is now preserved.
|
34
|
+
|
35
|
+
# 3.19.1
|
4
36
|
|
5
37
|
* When passing a Proc or lambda as response body to `to_return_json`, the body is evaluated at the time of request and not at the time of `to_return_json` method invocation.
|
6
38
|
|
7
39
|
Thanks to [Jason Karns](https://github.com/jasonkarns) for reporting.
|
8
40
|
|
41
|
+
# 3.19.0
|
42
|
+
|
9
43
|
* Do not alter real (non-stubbed) request headers when handling em-http-request requests.
|
10
44
|
|
11
45
|
Thanks to [Yoann Lecuyer](https://github.com/ylecuyer)
|
data/README.md
CHANGED
@@ -1189,6 +1189,12 @@ People who submitted patches and new features or suggested improvements. Many th
|
|
1189
1189
|
* Yuki Inoue
|
1190
1190
|
* Brandon Weaver
|
1191
1191
|
* Josh Nichols
|
1192
|
+
* Ricardo Trindade
|
1193
|
+
* Earlopain
|
1194
|
+
* James Brown
|
1195
|
+
* Kazuhiro NISHIYAMA
|
1196
|
+
* Étienne Barrié
|
1197
|
+
* Matt Brown
|
1192
1198
|
|
1193
1199
|
For a full list of contributors you can visit the
|
1194
1200
|
[contributors](https://github.com/bblimke/webmock/contributors) page.
|
@@ -156,7 +156,7 @@ if defined?(EventMachine::HttpClient)
|
|
156
156
|
raw_cookie = response_header.cookie
|
157
157
|
raw_cookie = [raw_cookie] if raw_cookie.is_a? String
|
158
158
|
|
159
|
-
cookie = raw_cookie.
|
159
|
+
cookie = raw_cookie.detect { |c| c.start_with? name }
|
160
160
|
cookie and cookie.split('=', 2)[1]
|
161
161
|
end
|
162
162
|
|
@@ -3,11 +3,21 @@
|
|
3
3
|
module HTTP
|
4
4
|
class Request
|
5
5
|
def webmock_signature
|
6
|
-
request_body =
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
request_body = nil
|
7
|
+
|
8
|
+
if defined?(HTTP::Request::Body)
|
9
|
+
request_body = String.new
|
10
|
+
first_chunk_encoding = nil
|
11
|
+
body.each do |part|
|
12
|
+
request_body << part
|
13
|
+
first_chunk_encoding ||= part.encoding
|
14
|
+
end
|
15
|
+
|
16
|
+
request_body.force_encoding(first_chunk_encoding) if first_chunk_encoding
|
17
|
+
request_body
|
18
|
+
else
|
19
|
+
request_body = body
|
20
|
+
end
|
11
21
|
|
12
22
|
::WebMock::RequestSignature.new(verb, uri.to_s, {
|
13
23
|
headers: headers.to_h,
|
@@ -157,14 +157,14 @@ if defined?(::HTTPClient)
|
|
157
157
|
end
|
158
158
|
|
159
159
|
def build_request_signature(req, reuse_existing = false)
|
160
|
-
uri = WebMock::Util::URI.heuristic_parse(req.header.request_uri.to_s)
|
161
|
-
uri.query = WebMock::Util::QueryMapper.values_to_query(req.header.request_query, notation: WebMock::Config.instance.query_values_notation) if req.header.request_query
|
162
|
-
uri.port = req.header.request_uri.port
|
163
|
-
|
164
160
|
@request_filter.each do |filter|
|
165
161
|
filter.filter_request(req)
|
166
162
|
end
|
167
163
|
|
164
|
+
uri = WebMock::Util::URI.heuristic_parse(req.header.request_uri.to_s)
|
165
|
+
uri.query = WebMock::Util::QueryMapper.values_to_query(req.header.request_query, notation: WebMock::Config.instance.query_values_notation) if req.header.request_query
|
166
|
+
uri.port = req.header.request_uri.port
|
167
|
+
|
168
168
|
headers = req.header.all.inject({}) do |hdrs, header|
|
169
169
|
hdrs[header[0]] ||= []
|
170
170
|
hdrs[header[0]] << header[1]
|
@@ -96,7 +96,14 @@ if defined?(Typhoeus)
|
|
96
96
|
status_message: "",
|
97
97
|
body: "",
|
98
98
|
headers: {},
|
99
|
-
return_code: :operation_timedout
|
99
|
+
return_code: :operation_timedout,
|
100
|
+
total_time: 0.0,
|
101
|
+
starttransfer_time: 0.0,
|
102
|
+
appconnect_time: 0.0,
|
103
|
+
pretransfer_time: 0.0,
|
104
|
+
connect_time: 0.0,
|
105
|
+
namelookup_time: 0.0,
|
106
|
+
redirect_time: 0.0
|
100
107
|
)
|
101
108
|
else
|
102
109
|
::Typhoeus::Response.new(
|
@@ -104,7 +111,14 @@ if defined?(Typhoeus)
|
|
104
111
|
status_message: webmock_response.status[1],
|
105
112
|
body: webmock_response.body,
|
106
113
|
headers: webmock_response.headers,
|
107
|
-
effective_url: request_signature.uri
|
114
|
+
effective_url: request_signature.uri,
|
115
|
+
total_time: 0.0,
|
116
|
+
starttransfer_time: 0.0,
|
117
|
+
appconnect_time: 0.0,
|
118
|
+
pretransfer_time: 0.0,
|
119
|
+
connect_time: 0.0,
|
120
|
+
namelookup_time: 0.0,
|
121
|
+
redirect_time: 0.0
|
108
122
|
)
|
109
123
|
end
|
110
124
|
response.mock = :webmock
|
@@ -47,7 +47,9 @@ module WebMock
|
|
47
47
|
# Rack-specific variables
|
48
48
|
env['rack.input'] = StringIO.new(body)
|
49
49
|
env['rack.errors'] = $stderr
|
50
|
-
|
50
|
+
if !Rack.const_defined?(:RELEASE) || Rack::RELEASE < "3"
|
51
|
+
env['rack.version'] = Rack::VERSION
|
52
|
+
end
|
51
53
|
env['rack.url_scheme'] = uri.scheme
|
52
54
|
env['rack.run_once'] = true
|
53
55
|
env['rack.session'] = session
|
data/lib/webmock/response.rb
CHANGED
data/lib/webmock/util/headers.rb
CHANGED
@@ -1,16 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'base64'
|
4
|
-
|
5
3
|
module WebMock
|
6
4
|
|
7
5
|
module Util
|
8
6
|
|
9
7
|
class Headers
|
10
8
|
|
11
|
-
STANDARD_HEADER_DELIMITER = '-'
|
12
|
-
NONSTANDARD_HEADER_DELIMITER = '_'
|
13
|
-
JOIN = ', '
|
9
|
+
STANDARD_HEADER_DELIMITER = '-'
|
10
|
+
NONSTANDARD_HEADER_DELIMITER = '_'
|
11
|
+
JOIN = ', '
|
14
12
|
|
15
13
|
def self.normalize_headers(headers)
|
16
14
|
return nil unless headers
|
@@ -59,7 +57,8 @@ module WebMock
|
|
59
57
|
end
|
60
58
|
|
61
59
|
def self.basic_auth_header(*credentials)
|
62
|
-
|
60
|
+
strict_base64_encoded = [credentials.join(':')].pack("m0")
|
61
|
+
"Basic #{strict_base64_encoded.chomp}"
|
63
62
|
end
|
64
63
|
|
65
64
|
def self.normalize_name(name)
|
data/lib/webmock/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webmock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bartosz Blimke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -198,6 +198,20 @@ dependencies:
|
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
200
|
version: 2.2.4
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: mutex_m
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
201
215
|
- !ruby/object:Gem::Dependency
|
202
216
|
name: excon
|
203
217
|
requirement: !ruby/object:Gem::Requirement
|
@@ -357,9 +371,9 @@ licenses:
|
|
357
371
|
- MIT
|
358
372
|
metadata:
|
359
373
|
bug_tracker_uri: https://github.com/bblimke/webmock/issues
|
360
|
-
changelog_uri: https://github.com/bblimke/webmock/blob/v3.
|
361
|
-
documentation_uri: https://www.rubydoc.info/gems/webmock/3.
|
362
|
-
source_code_uri: https://github.com/bblimke/webmock/tree/v3.
|
374
|
+
changelog_uri: https://github.com/bblimke/webmock/blob/v3.21.0/CHANGELOG.md
|
375
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.21.0
|
376
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.21.0
|
363
377
|
wiki_uri: https://github.com/bblimke/webmock/wiki
|
364
378
|
post_install_message:
|
365
379
|
rdoc_options: []
|
@@ -376,7 +390,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
390
|
- !ruby/object:Gem::Version
|
377
391
|
version: '0'
|
378
392
|
requirements: []
|
379
|
-
rubygems_version: 3.
|
393
|
+
rubygems_version: 3.5.6
|
380
394
|
signing_key:
|
381
395
|
specification_version: 4
|
382
396
|
summary: Library for stubbing HTTP requests in Ruby.
|