webmock 3.19.1 → 3.20.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 +25 -1
- data/README.md +4 -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/typhoeus_hydra_adapter.rb +16 -2
- 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: ffda5916fee8f80d1d0a725b7de314652a588658189bb28ad7a984551d406a3a
|
4
|
+
data.tar.gz: f2aa5c1f78094f72f9c7310dfbb3e866be2acc6910bd3c3a1a4e562744e0fa65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3fbfb98e4a6d090abd630ccfea78f5b06038e3f6d4683bd1f651f6c8b07b31698f71f9588df1a8d90066ab0d38a088a604204b4f710bfd9249235a9f2664453
|
7
|
+
data.tar.gz: ffcaf10bc3cd523f6c12c2209fc4e48fb34813e520789ca78ee0cb65b3285f7bf1534ef36faafbd61a49d82ca547f2ecfb3ea74b33b5ba3b4294493f0683942d
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,35 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
# 3.
|
3
|
+
# 3.20.0
|
4
|
+
|
5
|
+
* Optimised EmHttpRequestAdapter performance.
|
6
|
+
|
7
|
+
Thanks to [Ricardo Trindade](https://github.com/RicardoTrindade)
|
8
|
+
|
9
|
+
* Removed runtime dependency on base64.
|
10
|
+
|
11
|
+
Thanks to [Earlopain](https://github.com/Earlopain)
|
12
|
+
|
13
|
+
* Typhoeus::Response objects constructed from stubbed responses now have all timing attributes set to 0.0.
|
14
|
+
|
15
|
+
Thanks to [James Brown](https://github.com/Roguelazer)
|
16
|
+
|
17
|
+
* Optimised WebMock::Util::Headers by removing redundant freeze invocations.
|
18
|
+
|
19
|
+
Thanks to [Kazuhiro NISHIYAMA](https://github.com/znz)
|
20
|
+
|
21
|
+
* The default stubbed response body, which is an empty String, is unfrozen.
|
22
|
+
|
23
|
+
* When building signatures of requests made by http.rb, the request body encoding is now preserved.
|
24
|
+
|
25
|
+
# 3.19.1
|
4
26
|
|
5
27
|
* 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
28
|
|
7
29
|
Thanks to [Jason Karns](https://github.com/jasonkarns) for reporting.
|
8
30
|
|
31
|
+
# 3.19.0
|
32
|
+
|
9
33
|
* Do not alter real (non-stubbed) request headers when handling em-http-request requests.
|
10
34
|
|
11
35
|
Thanks to [Yoann Lecuyer](https://github.com/ylecuyer)
|
data/README.md
CHANGED
@@ -1189,6 +1189,10 @@ 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
|
1192
1196
|
|
1193
1197
|
For a full list of contributors you can visit the
|
1194
1198
|
[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,
|
@@ -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
|
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.20.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-06 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.20.0/CHANGELOG.md
|
375
|
+
documentation_uri: https://www.rubydoc.info/gems/webmock/3.20.0
|
376
|
+
source_code_uri: https://github.com/bblimke/webmock/tree/v3.20.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.3
|
380
394
|
signing_key:
|
381
395
|
specification_version: 4
|
382
396
|
summary: Library for stubbing HTTP requests in Ruby.
|