http.rb 1.7.1 → 1.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +11 -0
- data/lib/HTTP/VERSION.rb +1 -1
- data/lib/Hash/x_www_form_urlencode.rb +1 -1
- data/lib/Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb +1 -1
- data/lib/http.rb +2 -2
- data/test/loading_test.rb +27 -2
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f393fe0aa1125d6e4e74ee456067818c3c95c770fbefdf7b5e19487579e26bc1
|
|
4
|
+
data.tar.gz: 075d928ed5316c24f69134b768f80e8037fbbe6f58a6614be461ed0ed7c39328
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2ed096075f4e6c25567e4bf89bee9ba39c6548bef5229b7771d5f992a60fbeb6fc9b6412d60c526c6aed7fd92485860a9c03c855bb27a93c45065b3a662c47f
|
|
7
|
+
data.tar.gz: 0c4c65e4ee9d5973e2a96ce941d6b99011da0108b477e52ed46a8206abdf91adebe0b3956131a594a7b4833d0cd9c8425b1a0252ecdb83978da61f57e31e4a47
|
data/CHANGELOG
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# http/CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 20261129
|
|
4
|
+
|
|
5
|
+
1.7.2: http.rb's own files are required relatively, so as files of the same names elsewhere on the load path aren't loaded in their place.
|
|
6
|
+
|
|
7
|
+
1. ~ lib/http.rb: require_relative './HTTP/METHODS' and './HTTP/VERSION'.
|
|
8
|
+
2. ~ lib/Hash/x_www_form_urlencode.rb: require_relative '../Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode'. An older copy earlier on the load path had been loaded in its place, so an array went as its inspect string.
|
|
9
|
+
3. ~ lib/Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb: require_relative '../../String/Urlencode/urlencode'.
|
|
10
|
+
4. ~ test/loading_test.rb: With a decoy of each of those files first on the load path, requiring the gem loads none of them. ruby(): + load_path:.
|
|
11
|
+
5. ~ HTTP::VERSION: /1.7.1/1.7.2/
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
## 20261019
|
|
4
15
|
|
|
5
16
|
1.7.1: Args are joined to a query already in the URI with an ampersand, and an array among them repeats its key.
|
data/lib/HTTP/VERSION.rb
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
# 0/1: An array value repeats its key for each element.
|
|
12
12
|
# 3. ~ x_www_form_urlencode: an array value gives a pair for each of its elements, as URI.encode_www_form does, rather than one pair holding the array's inspect string, '[1, 2]'; a nil element is left out, as a nil value is.
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
require_relative '../../String/Urlencode/urlencode'
|
|
15
15
|
|
|
16
16
|
module Thoran
|
|
17
17
|
module Hash
|
data/lib/http.rb
CHANGED
data/test/loading_test.rb
CHANGED
|
@@ -1,15 +1,34 @@
|
|
|
1
1
|
# test/loading_test.rb
|
|
2
2
|
|
|
3
|
+
require 'fileutils'
|
|
3
4
|
require 'minitest/autorun'
|
|
5
|
+
require 'tmpdir'
|
|
4
6
|
|
|
5
7
|
require_relative '../lib/http'
|
|
6
8
|
|
|
7
9
|
# In its own process, since this one has loaded the file directly and so could
|
|
8
10
|
# not tell what requiring the gem by its own name would bring.
|
|
9
11
|
describe 'loading' do
|
|
10
|
-
def ruby(source)
|
|
12
|
+
def ruby(source, load_path: [])
|
|
11
13
|
lib = File.expand_path('../lib', __dir__)
|
|
12
|
-
|
|
14
|
+
includes = (load_path + [lib]).map{|directory| "-I#{directory}"}
|
|
15
|
+
IO.popen(['ruby', *includes, '-e', source], err: [:child, :out]){|io| io.read}.strip
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Files of the same names as those lib/ carries, each failing if it's loaded.
|
|
19
|
+
def with_decoys
|
|
20
|
+
Dir.mktmpdir do |directory|
|
|
21
|
+
%w{
|
|
22
|
+
HTTP/METHODS.rb
|
|
23
|
+
HTTP/VERSION.rb
|
|
24
|
+
Thoran/Hash/XWwwFormUrlencode/x_www_form_urlencode.rb
|
|
25
|
+
Thoran/String/Urlencode/urlencode.rb
|
|
26
|
+
}.each do |path|
|
|
27
|
+
FileUtils.mkdir_p(File.join(directory, File.dirname(path)))
|
|
28
|
+
File.write(File.join(directory, path), "raise 'A decoy #{path} was loaded.'\n")
|
|
29
|
+
end
|
|
30
|
+
yield(directory)
|
|
31
|
+
end
|
|
13
32
|
end
|
|
14
33
|
|
|
15
34
|
# The gem is http.rb, so require 'http.rb' reads lib/http.rb. A capitalised
|
|
@@ -27,4 +46,10 @@ describe 'loading' do
|
|
|
27
46
|
it "defines the version too" do
|
|
28
47
|
_(ruby('require "http.rb"; print HTTP::VERSION')).must_equal HTTP::VERSION
|
|
29
48
|
end
|
|
49
|
+
|
|
50
|
+
it "loads its own files, though others of the same names come first on the load path" do
|
|
51
|
+
with_decoys do |directory|
|
|
52
|
+
_(ruby('require "http.rb"; print HTTP::VERSION, " ", {a: [1, 2]}.x_www_form_urlencode', load_path: [directory])).must_equal "#{HTTP::VERSION} a=1&a=2"
|
|
53
|
+
end
|
|
54
|
+
end
|
|
30
55
|
end
|