faraday-net_http 2.0.0.alpha.pre.1 → 2.0.0.alpha.pre.2

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: f906e027c9d891ccc21f9a1b750e1cb917d56315d8661d7a1a4278eb18ff1084
4
- data.tar.gz: 4cd64aad7008c122cbcaae48bfcb4b61c6387557552c5a5405981cd0b70389be
3
+ metadata.gz: 50f1e65c56e527b724b107dbf1f4580f4de9e7d102d4617ed3c5bceecd4a1b07
4
+ data.tar.gz: f6ad202b18f54eaa665b3407bc0297c41e6ba41259220b21e186493c45019c16
5
5
  SHA512:
6
- metadata.gz: '0793967f3175c622bc15b797124a857f6ddc56eb8284e37dae9fe8bb643061bc160793a1f925e2654b309e87fd8badae5a557bcf2a1260a4fa4c1ed0c9f50367'
7
- data.tar.gz: 8d44d2ca498d7f0f1cd3903b56f673f8c8d13648871c5b298d0cfca8ab99d191fbb2dbb904803450b48724c4c77a533791e835247f8cca8c880a4b0f903d4a40
6
+ metadata.gz: 00e25dfdbdafe00431648975d8a31ba2ea53e4c74d688e937a0a4e87524a6987370fd99a81a22eb2548e587d138822e0984f698315c223a4baeb5f0aed8b0815
7
+ data.tar.gz: f470b1b56a0a40a590cf492c85f53e089c64ec95ff55f52a1c579b18fa304ba3c80dbf01c0e2d403a341f416cf7eb5dba953cf37c07f33a3db58a0d66d9bf088
@@ -62,17 +62,15 @@ module Faraday
62
62
  def call(env)
63
63
  super
64
64
  http_response = connection(env) do |http|
65
- begin
66
- perform_request(http, env)
67
- rescue *NET_HTTP_EXCEPTIONS => e
68
- raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
65
+ perform_request(http, env)
66
+ rescue *NET_HTTP_EXCEPTIONS => e
67
+ raise Faraday::SSLError, e if defined?(OpenSSL) && e.is_a?(OpenSSL::SSL::SSLError)
69
68
 
70
- raise Faraday::ConnectionFailed, e
71
- end
69
+ raise Faraday::ConnectionFailed, e
72
70
  end
73
71
 
74
72
  save_response(env, http_response.code.to_i,
75
- http_response.body || +'', nil,
73
+ encoded_body(http_response), nil,
76
74
  http_response.message) do |response_headers|
77
75
  http_response.each_header do |key, value|
78
76
  response_headers[key] = value
@@ -208,6 +206,18 @@ module Faraday
208
206
  end
209
207
  end
210
208
  end
209
+
210
+ def encoded_body(http_response)
211
+ body = http_response.body || +''
212
+ /\bcharset=\s*(.+?)\s*(;|$)/.match(http_response['Content-Type']) do |match|
213
+ content_charset = Encoding.find(match.captures.first)
214
+ body = body.dup if body.frozen?
215
+ body.force_encoding(content_charset)
216
+ rescue ArgumentError
217
+ nil
218
+ end
219
+ body
220
+ end
211
221
  end
212
222
  end
213
223
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Faraday
4
4
  module NetHttp
5
- VERSION = '2.0.0.alpha-1'
5
+ VERSION = '2.0.0.alpha-2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: faraday-net_http
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.alpha.pre.1
4
+ version: 2.0.0.alpha.pre.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan van der Pas
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-01 00:00:00.000000000 Z
11
+ date: 2021-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -24,132 +24,6 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 2.0.0.alpha.pre.2
27
- - !ruby/object:Gem::Dependency
28
- name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '2.0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '2.0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '13.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '13.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
69
- - !ruby/object:Gem::Dependency
70
- name: simplecov
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 0.19.0
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 0.19.0
83
- - !ruby/object:Gem::Dependency
84
- name: multipart-parser
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 0.1.1
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 0.1.1
97
- - !ruby/object:Gem::Dependency
98
- name: webmock
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - "~>"
102
- - !ruby/object:Gem::Version
103
- version: '3.4'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - "~>"
109
- - !ruby/object:Gem::Version
110
- version: '3.4'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: 0.91.1
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: 0.91.1
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-packaging
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.5'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - "~>"
137
- - !ruby/object:Gem::Version
138
- version: '0.5'
139
- - !ruby/object:Gem::Dependency
140
- name: rubocop-performance
141
- requirement: !ruby/object:Gem::Requirement
142
- requirements:
143
- - - "~>"
144
- - !ruby/object:Gem::Version
145
- version: '1.0'
146
- type: :development
147
- prerelease: false
148
- version_requirements: !ruby/object:Gem::Requirement
149
- requirements:
150
- - - "~>"
151
- - !ruby/object:Gem::Version
152
- version: '1.0'
153
27
  description: Faraday adapter for Net::HTTP
154
28
  email:
155
29
  - janvanderpas@gmail.com
@@ -168,7 +42,7 @@ licenses:
168
42
  metadata:
169
43
  homepage_uri: https://github.com/lostisland/faraday-net_http
170
44
  source_code_uri: https://github.com/lostisland/faraday-net_http
171
- changelog_uri: https://github.com/lostisland/faraday-net_http
45
+ changelog_uri: https://github.com/lostisland/faraday-net_http/releases/tag/v2.0.0.alpha.pre.2
172
46
  post_install_message:
173
47
  rdoc_options: []
174
48
  require_paths: