http2 0.0.33 → 0.0.34

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 856e9e6edf6d355dc73912489a6263a6a213abbaa1ec87f6fa4b5547f727f336
4
- data.tar.gz: f4062dda7f2970331ab68a9e38095fe7bc729f61a27305e7eaea4ddb9a2d28fe
3
+ metadata.gz: 86c71528bc092c75bb6c6ec82ec5dc2dd8ca73bc7836ca235a8f66f7a8be26bd
4
+ data.tar.gz: 8eb7666d2020f5a38ae91c45d38f11cf772f136cb8a30c17c104d96743a6d967
5
5
  SHA512:
6
- metadata.gz: 8ca5c943ae78a977a5253487670755830ea8225b417f79238cbaff5cf6d4f3adabe1e572b6480325c19e6cb317f35e10d2ef491de79df9d15cc7f6f8014f2b13
7
- data.tar.gz: aead6eadd6b8569bab500e3ebf64bea0188ebf06739c83ba78d1f1fcd70b3b3ac0a6ad2516610bdefd2751bc63acb53c352fbbc1e3e310931d41ab0b6bf72f18
6
+ metadata.gz: 9411f817d1409689d895e01a6bb8cc22fe07f04c4e1b3ce03649ef23680da7dbc52fe3427c13171106453f3b08dc3e9f84cab938c1154bca0611e720d41e7c6e
7
+ data.tar.gz: b1214c3a8936c7fb605b731ed0b638a4aad0185890c3b58f4d083ac8ec950d3fe565e0bc863a29b3888d4e7762ed2b2e14237e5d2a51f2ba424fa50faa2cecdb
@@ -87,7 +87,6 @@ class Http2
87
87
  #===Examples
88
88
  # http.destroy
89
89
  def destroy
90
- @args = nil
91
90
  @cookies = nil
92
91
  @debug = nil
93
92
  @mutex = nil
@@ -58,7 +58,7 @@ class Http2::Response
58
58
 
59
59
  # Returns true if the result is JSON.
60
60
  def json?
61
- content_type == "application/json"
61
+ content_type&.start_with?("application/json")
62
62
  end
63
63
 
64
64
  def json
@@ -15,10 +15,30 @@ describe Http2::Response do
15
15
  end
16
16
  end
17
17
 
18
- it "#json?" do
19
- with_http do |http|
20
- res = http.get("json_test.rhtml")
21
- expect(res.json?).to eq true
18
+ describe "#json?" do
19
+ it "returns true for 'application/json'" do
20
+ with_http do |http|
21
+ res = http.get("json_test.rhtml")
22
+
23
+ expect(res).to receive(:content_type).and_return("application/json")
24
+ expect(res.json?).to eq true
25
+ end
26
+ end
27
+
28
+ it "returns true for 'application/json'" do
29
+ with_http do |http|
30
+ res = http.get("json_test.rhtml")
31
+ expect(res.json?).to eq true
32
+ end
33
+ end
34
+
35
+ it "returns true for 'application/json'" do
36
+ with_http do |http|
37
+ res = http.post(url: "json_test.rhtml", post: {test: "test2"})
38
+
39
+ expect(res).to receive(:content_type).and_return("application/json; charset=utf-8")
40
+ expect(res.json?).to eq true
41
+ end
22
42
  end
23
43
  end
24
44
 
@@ -3,6 +3,7 @@ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
3
  require "rspec"
4
4
  require "http2"
5
5
  require "helpers"
6
+ require "json"
6
7
 
7
8
  # Requires supporting files with custom matchers and macros, etc,
8
9
  # in ./support/ and its subdirectories.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.33
4
+ version: 0.0.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Johansen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-12-05 00:00:00.000000000 Z
11
+ date: 2020-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: string-cases
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: json
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: hayabusa
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +212,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
198
212
  - !ruby/object:Gem::Version
199
213
  version: '0'
200
214
  requirements: []
201
- rubygems_version: 3.0.4
215
+ rubyforge_project:
216
+ rubygems_version: 2.7.9
202
217
  signing_key:
203
218
  specification_version: 4
204
219
  summary: A lightweight framework for doing http-connections in Ruby. Supports cookies,