httpx 1.3.3 → 1.3.4

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: 8829f986611d6b07d5c8b14ed0a51152e7f9303d01d1ec9469263f78843ce339
4
- data.tar.gz: 8e55596dd065b9b3d352a0ad3173577556ea5bfb7963ea85287bb58d9018160b
3
+ metadata.gz: 59239a38c693a32e279f32e5f153f606fdc83e0cdce02e6079947cc8f8d6e0d0
4
+ data.tar.gz: c386fbdd0409186f50390a2379c3945add29a7cafac805bbd0c780992e933437
5
5
  SHA512:
6
- metadata.gz: b46a5f9f27b7571051fc95ef5d11d03cdaaa822cd08684ad1b1cf2605aacabc42ea1762f152303932bdd1e1f41c89447017ffcfaee8f995f04fdd908cbe69444
7
- data.tar.gz: 57c5407473eb1fa8bbe7e4f3e3fef3288e8a8074776378a130894e72931833acf7bd30cd235f904fcd96cda810a3ec7118a3de9a66b28124ffd18de6b2fc1c42
6
+ metadata.gz: 5d142fdfe649e0447f3043e5eebd52776c71c44c4b141607b061895c520e32a5d1da0c5c678c6fd6cdb9f572e1d3c43165d8c26bf006420c2b89ce66c547c986
7
+ data.tar.gz: 77435864f6afd01fdb7fbc8e1019928411a50032c11751220062f1fff804355d0220823f18cbef430e47bc26f3c28fab826513a242222ccdb003eae949a41b97
@@ -1,4 +1,4 @@
1
- # 1.3.2
1
+ # 1.3.3
2
2
 
3
3
  ## Bugfixes
4
4
 
@@ -0,0 +1,6 @@
1
+ # 1.3.4
2
+
3
+ ## Bugfixes
4
+
5
+ * webmock adapter: fix tempfile usage in multipart requests.
6
+ * fix: fallback to binary encoding when parsing incoming invalid charset in HTTP "content-type" header.
@@ -17,12 +17,23 @@ module HTTPX
17
17
  @headers = response.headers
18
18
  @options = options
19
19
  @window_size = options.window_size
20
- @encoding = response.content_type.charset || Encoding::BINARY
21
20
  @encodings = []
22
21
  @length = 0
23
22
  @buffer = nil
24
23
  @reader = nil
25
24
  @state = :idle
25
+
26
+ # initialize response encoding
27
+ @encoding = if (enc = response.content_type.charset)
28
+ begin
29
+ Encoding.find(enc)
30
+ rescue ArgumentError
31
+ Encoding::BINARY
32
+ end
33
+ else
34
+ Encoding::BINARY
35
+ end
36
+
26
37
  initialize_inflaters
27
38
  end
28
39
 
@@ -35,7 +35,9 @@ module HTTPX
35
35
 
36
36
  def rewind
37
37
  form = @form.each_with_object([]) do |(key, val), aux|
38
- val = val.reopen(val.path, File::RDONLY) if val.is_a?(File) && val.closed?
38
+ if val.respond_to?(:path) && val.respond_to?(:reopen) && val.respond_to?(:closed?) && val.closed?
39
+ val = val.reopen(val.path, File::RDONLY)
40
+ end
39
41
  val.rewind if val.respond_to?(:rewind)
40
42
  aux << [key, val]
41
43
  end
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "1.3.3"
4
+ VERSION = "1.3.4"
5
5
  end
@@ -4,8 +4,8 @@ module HTTPX
4
4
  include _ToS
5
5
  include _ToStr
6
6
 
7
- attr_reader encoding: Encoding | String
8
- attr_reader encodings: Array[Encoding | String]
7
+ attr_reader encoding: Encoding
8
+ attr_reader encodings: Array[String]
9
9
 
10
10
  @response: Response
11
11
  @headers: Headers
@@ -5,7 +5,7 @@ module HTTPX
5
5
  @encoding: Encoding
6
6
  @buffer: StringIO | Tempfile
7
7
 
8
- def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding | String) -> void
8
+ def initialize: (threshold_size: Integer, ?bytesize: Integer, ?encoding: Encoding) -> void
9
9
 
10
10
  def size: () -> Integer
11
11
 
@@ -9,7 +9,7 @@ module HTTPX
9
9
 
10
10
  MULTIPART_VALUE_COND: ^(_Reader | record_multipart_value value) -> bool
11
11
 
12
- type multipart_value = string | Pathname | File | _Reader
12
+ type multipart_value = string | Pathname | File | Tempfile | _Reader
13
13
 
14
14
  type record_multipart_value = { content_type: String, filename: String, body: multipart_value } |
15
15
  { content_type: String, body: multipart_value }
@@ -83,13 +83,13 @@ module HTTPX
83
83
 
84
84
  module Part
85
85
  def self?.call: [U] (Object & _MultipartInput multipart_input) -> [U, String, String]
86
- | (Object & multipart_nested_value input) -> ([StringIO, String, String?] | [File, String, String])
86
+ | (multipart_nested_value value) -> ([StringIO, String, String?] | [File | Tempfile, String, String])
87
87
  end
88
88
 
89
89
  module MimeTypeDetector
90
90
  DEFAULT_MIMETYPE: String
91
91
 
92
- def self?.call: (::IO file, String filename) -> String?
92
+ def self?.call: (::IO | Tempfile file, String filename) -> String?
93
93
  end
94
94
  end
95
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.3
4
+ version: 1.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-31 00:00:00.000000000 Z
11
+ date: 2024-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2
@@ -148,6 +148,7 @@ extra_rdoc_files:
148
148
  - doc/release_notes/1_3_1.md
149
149
  - doc/release_notes/1_3_2.md
150
150
  - doc/release_notes/1_3_3.md
151
+ - doc/release_notes/1_3_4.md
151
152
  files:
152
153
  - LICENSE.txt
153
154
  - README.md
@@ -267,6 +268,7 @@ files:
267
268
  - doc/release_notes/1_3_1.md
268
269
  - doc/release_notes/1_3_2.md
269
270
  - doc/release_notes/1_3_3.md
271
+ - doc/release_notes/1_3_4.md
270
272
  - lib/httpx.rb
271
273
  - lib/httpx/adapters/datadog.rb
272
274
  - lib/httpx/adapters/faraday.rb