htty 1.4.1 → 1.5.0
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 +7 -0
- data/.gitignore +2 -1
- data/.rspec +2 -0
- data/.travis.yml +21 -3
- data/.yardopts +1 -1
- data/Gemfile +2 -2
- data/Guardfile +12 -10
- data/History.markdown +14 -0
- data/{MIT-LICENSE.markdown → License.markdown} +1 -1
- data/README.markdown +50 -65
- data/Rakefile +2 -2
- data/htty.gemspec +2 -2
- data/lib/htty/cli.rb +59 -74
- data/lib/htty/cli/command.rb +21 -20
- data/lib/htty/cli/commands/body_edit.rb +89 -0
- data/lib/htty/cli/commands/query_add.rb +3 -0
- data/lib/htty/cli/commands/query_set.rb +3 -0
- data/lib/htty/cli/commands/userinfo_set.rb +8 -14
- data/lib/htty/cli/display.rb +14 -12
- data/lib/htty/cli/input_device.rb +75 -0
- data/lib/htty/cli/url_escaping.rb +2 -2
- data/lib/htty/headers.rb +81 -0
- data/lib/htty/no_header_error.rb +10 -0
- data/lib/htty/payload.rb +22 -9
- data/lib/htty/request.rb +67 -43
- data/lib/htty/requests_util.rb +22 -8
- data/lib/htty/response.rb +20 -1
- data/lib/htty/uri.rb +16 -0
- data/lib/htty/version.rb +1 -1
- data/spec/integration/htty/cli/commands/query_add_spec.rb +7 -1
- data/spec/integration/htty/cli/commands/query_remove_spec.rb +19 -1
- data/spec/integration/htty/cli/commands/query_set_spec.rb +9 -3
- data/spec/integration/htty/cli/commands/query_unset_spec.rb +8 -2
- data/spec/spec_helper.rb +69 -0
- data/spec/unit/htty/cli/commands/address_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/body_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/body_edit_spec.rb +18 -0
- data/spec/unit/htty/cli/commands/body_request_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/body_response_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/body_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/body_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cd_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookie_add_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookie_remove_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_add_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_remove_all_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_remove_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/cookies_use_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/delete_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/exit_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/follow_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/form_add_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/form_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/form_remove_all_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/form_remove_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/form_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/fragment_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/fragment_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/fragment_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/get_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/header_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/header_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_request_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_response_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_unset_all_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/headers_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/help_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/history_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/history_verbose_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/host_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_delete_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_get_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_head_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_options_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_patch_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_post_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_put_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/http_trace_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/patch_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/path_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/port_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/post_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/put_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_add_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_remove_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_unset_all_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/query_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/quit_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/reuse_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/scheme_set_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/shared_examples_for_commands.rb +55 -0
- data/spec/unit/htty/cli/commands/ssl_verification_off_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/ssl_verification_on_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/ssl_verification_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/status_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/undo_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/userinfo_clear_spec.rb +1 -1
- data/spec/unit/htty/cli/commands/userinfo_set_spec.rb +23 -1
- data/spec/unit/htty/cli/commands/userinfo_unset_spec.rb +1 -1
- data/spec/unit/htty/cli/display_spec.rb +84 -0
- data/spec/unit/htty/cli_spec.rb +1 -1
- data/spec/unit/htty/command.rb +47 -0
- data/spec/unit/htty/{ordered_hash_spec.rb → headers_spec.rb} +4 -4
- data/spec/unit/htty/payload_spec.rb +60 -0
- data/spec/unit/htty/preferences_spec.rb +1 -1
- data/spec/unit/htty/request_follow_spec.rb +94 -0
- data/spec/unit/htty/request_spec.rb +5 -187
- data/spec/unit/htty/request_userinfo_spec.rb +208 -0
- data/spec/unit/htty/session_spec.rb +1 -1
- data/spec/unit/htty/shared_examples_for_requests.rb +32 -0
- data/spec/unit/htty/url_escaping.rb +70 -0
- data/spec/unit/htty/version_spec.rb +1 -1
- metadata +43 -30
- data/lib/htty/ordered_hash.rb +0 -68
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
shared_examples_for 'an empty request' do
|
|
2
|
+
it 'should have only the default headers' do
|
|
3
|
+
request.headers.should == [
|
|
4
|
+
['User-Agent', "htty/#{HTTY::VERSION}"]
|
|
5
|
+
]
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
it 'should have no body' do
|
|
9
|
+
request.body.should be_nil
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'should have no response' do
|
|
13
|
+
request.response.should be_nil
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
shared_examples_for 'an empty, authenticated request' do
|
|
18
|
+
it 'should the expected Authorization header plus the default headers' do
|
|
19
|
+
request.headers.should == [
|
|
20
|
+
['User-Agent', "htty/#{HTTY::VERSION}"],
|
|
21
|
+
HTTY::Headers.basic_authentication_for(username, password)
|
|
22
|
+
]
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'should have no body' do
|
|
26
|
+
request.body.should be_nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'should have no response' do
|
|
30
|
+
request.response.should be_nil
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../../../lib/htty/cli/url_escaping")
|
|
3
|
+
|
|
4
|
+
describe HTTY::CLI::UrlEscaping do
|
|
5
|
+
subject do
|
|
6
|
+
o = Object.new.extend(HTTY::CLI::UrlEscaping)
|
|
7
|
+
o.stub(:say)
|
|
8
|
+
o
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
describe '.escape_or_warn_of_escape_sequences' do
|
|
12
|
+
context 'when argument is already escaped' do
|
|
13
|
+
let(:escaped_string) {'Hello%20World'}
|
|
14
|
+
|
|
15
|
+
it 'should not escape it twice' do
|
|
16
|
+
should_not_escape(escaped_string)
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
it 'should warn the user' do
|
|
20
|
+
subject.should_receive(:say).once
|
|
21
|
+
escape(escaped_string)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
context 'when argument contains reserved characters' do
|
|
26
|
+
let(:unescaped_string) {'Hello World'}
|
|
27
|
+
|
|
28
|
+
it 'should escape it' do
|
|
29
|
+
should_escape(unescaped_string)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
it 'should not warn the user' do
|
|
33
|
+
subject.should_receive(:say).never
|
|
34
|
+
escape(unescaped_string)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
context 'when argument contains not reserved characters' do
|
|
39
|
+
let(:unescaped_string) {'HelloWorld'}
|
|
40
|
+
|
|
41
|
+
it 'should not escape it' do
|
|
42
|
+
should_not_escape(unescaped_string)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'should not warn the user' do
|
|
46
|
+
subject.should_receive(:say).never
|
|
47
|
+
escape(unescaped_string)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# http://tools.ietf.org/html/rfc3986#section-2.2
|
|
52
|
+
":/?#[]@!$&'()*+,;=".each_char do |reserved_character|
|
|
53
|
+
it "should escape reserved character '#{reserved_character}'" do
|
|
54
|
+
should_escape(reserved_character)
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def should_escape(s)
|
|
60
|
+
escape(s).should_not == [s]
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
def should_not_escape(s)
|
|
64
|
+
escape(s).should == [s]
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def escape(s)
|
|
68
|
+
subject.escape_or_warn_of_escape_sequences([s])
|
|
69
|
+
end
|
|
70
|
+
end
|
metadata
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: htty
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
5
|
-
prerelease:
|
|
4
|
+
version: 1.5.0
|
|
6
5
|
platform: ruby
|
|
7
6
|
authors:
|
|
8
7
|
- Nils Jonsson
|
|
9
8
|
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 2014-04-01 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
14
|
name: mime-types
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
|
-
none: false
|
|
18
16
|
requirements:
|
|
19
17
|
- - ~>
|
|
20
18
|
- !ruby/object:Gem::Version
|
|
@@ -22,7 +20,6 @@ dependencies:
|
|
|
22
20
|
type: :runtime
|
|
23
21
|
prerelease: false
|
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
-
none: false
|
|
26
23
|
requirements:
|
|
27
24
|
- - ~>
|
|
28
25
|
- !ruby/object:Gem::Version
|
|
@@ -30,23 +27,20 @@ dependencies:
|
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
|
31
28
|
name: rake
|
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
|
33
|
-
none: false
|
|
34
30
|
requirements:
|
|
35
|
-
- -
|
|
31
|
+
- - '>='
|
|
36
32
|
- !ruby/object:Gem::Version
|
|
37
33
|
version: '0'
|
|
38
34
|
type: :development
|
|
39
35
|
prerelease: false
|
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
41
|
-
none: false
|
|
42
37
|
requirements:
|
|
43
|
-
- -
|
|
38
|
+
- - '>='
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '0'
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
|
47
42
|
name: rspec
|
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
|
49
|
-
none: false
|
|
50
44
|
requirements:
|
|
51
45
|
- - ~>
|
|
52
46
|
- !ruby/object:Gem::Version
|
|
@@ -54,16 +48,14 @@ dependencies:
|
|
|
54
48
|
type: :development
|
|
55
49
|
prerelease: false
|
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
57
|
-
none: false
|
|
58
51
|
requirements:
|
|
59
52
|
- - ~>
|
|
60
53
|
- !ruby/object:Gem::Version
|
|
61
54
|
version: '2'
|
|
62
|
-
description:
|
|
63
|
-
|
|
64
|
-
It'
|
|
65
|
-
|
|
66
|
-
outs of HTTP.'
|
|
55
|
+
description: |-
|
|
56
|
+
htty is a console application for interacting with web servers.
|
|
57
|
+
It's a fun way to explore web APIs and to learn the ins and
|
|
58
|
+
outs of HTTP.
|
|
67
59
|
email:
|
|
68
60
|
- htty@nilsjonsson.com
|
|
69
61
|
executables:
|
|
@@ -73,12 +65,13 @@ extra_rdoc_files: []
|
|
|
73
65
|
files:
|
|
74
66
|
- .gemtest
|
|
75
67
|
- .gitignore
|
|
68
|
+
- .rspec
|
|
76
69
|
- .travis.yml
|
|
77
70
|
- .yardopts
|
|
78
71
|
- Gemfile
|
|
79
72
|
- Guardfile
|
|
80
73
|
- History.markdown
|
|
81
|
-
-
|
|
74
|
+
- License.markdown
|
|
82
75
|
- README.markdown
|
|
83
76
|
- Rakefile
|
|
84
77
|
- bin/htty
|
|
@@ -90,6 +83,7 @@ files:
|
|
|
90
83
|
- lib/htty/cli/commands.rb
|
|
91
84
|
- lib/htty/cli/commands/address.rb
|
|
92
85
|
- lib/htty/cli/commands/body_clear.rb
|
|
86
|
+
- lib/htty/cli/commands/body_edit.rb
|
|
93
87
|
- lib/htty/cli/commands/body_request.rb
|
|
94
88
|
- lib/htty/cli/commands/body_request_open.rb
|
|
95
89
|
- lib/htty/cli/commands/body_response.rb
|
|
@@ -161,13 +155,15 @@ files:
|
|
|
161
155
|
- lib/htty/cli/commands/userinfo_unset.rb
|
|
162
156
|
- lib/htty/cli/display.rb
|
|
163
157
|
- lib/htty/cli/http_method_command.rb
|
|
158
|
+
- lib/htty/cli/input_device.rb
|
|
164
159
|
- lib/htty/cli/url_escaping.rb
|
|
165
160
|
- lib/htty/cookies_util.rb
|
|
161
|
+
- lib/htty/headers.rb
|
|
166
162
|
- lib/htty/http_patch.rb
|
|
163
|
+
- lib/htty/no_header_error.rb
|
|
167
164
|
- lib/htty/no_location_header_error.rb
|
|
168
165
|
- lib/htty/no_response_error.rb
|
|
169
166
|
- lib/htty/no_set_cookie_header_error.rb
|
|
170
|
-
- lib/htty/ordered_hash.rb
|
|
171
167
|
- lib/htty/payload.rb
|
|
172
168
|
- lib/htty/platform.rb
|
|
173
169
|
- lib/htty/preferences.rb
|
|
@@ -176,13 +172,16 @@ files:
|
|
|
176
172
|
- lib/htty/response.rb
|
|
177
173
|
- lib/htty/session.rb
|
|
178
174
|
- lib/htty/tempfile_preserving_extname.rb
|
|
175
|
+
- lib/htty/uri.rb
|
|
179
176
|
- lib/htty/version.rb
|
|
180
177
|
- spec/integration/htty/cli/commands/query_add_spec.rb
|
|
181
178
|
- spec/integration/htty/cli/commands/query_remove_spec.rb
|
|
182
179
|
- spec/integration/htty/cli/commands/query_set_spec.rb
|
|
183
180
|
- spec/integration/htty/cli/commands/query_unset_spec.rb
|
|
181
|
+
- spec/spec_helper.rb
|
|
184
182
|
- spec/unit/htty/cli/commands/address_spec.rb
|
|
185
183
|
- spec/unit/htty/cli/commands/body_clear_spec.rb
|
|
184
|
+
- spec/unit/htty/cli/commands/body_edit_spec.rb
|
|
186
185
|
- spec/unit/htty/cli/commands/body_request_spec.rb
|
|
187
186
|
- spec/unit/htty/cli/commands/body_response_spec.rb
|
|
188
187
|
- spec/unit/htty/cli/commands/body_set_spec.rb
|
|
@@ -242,6 +241,7 @@ files:
|
|
|
242
241
|
- spec/unit/htty/cli/commands/quit_spec.rb
|
|
243
242
|
- spec/unit/htty/cli/commands/reuse_spec.rb
|
|
244
243
|
- spec/unit/htty/cli/commands/scheme_set_spec.rb
|
|
244
|
+
- spec/unit/htty/cli/commands/shared_examples_for_commands.rb
|
|
245
245
|
- spec/unit/htty/cli/commands/ssl_verification_off_spec.rb
|
|
246
246
|
- spec/unit/htty/cli/commands/ssl_verification_on_spec.rb
|
|
247
247
|
- spec/unit/htty/cli/commands/ssl_verification_spec.rb
|
|
@@ -250,48 +250,53 @@ files:
|
|
|
250
250
|
- spec/unit/htty/cli/commands/userinfo_clear_spec.rb
|
|
251
251
|
- spec/unit/htty/cli/commands/userinfo_set_spec.rb
|
|
252
252
|
- spec/unit/htty/cli/commands/userinfo_unset_spec.rb
|
|
253
|
+
- spec/unit/htty/cli/display_spec.rb
|
|
253
254
|
- spec/unit/htty/cli_spec.rb
|
|
254
|
-
- spec/unit/htty/
|
|
255
|
+
- spec/unit/htty/command.rb
|
|
256
|
+
- spec/unit/htty/headers_spec.rb
|
|
257
|
+
- spec/unit/htty/payload_spec.rb
|
|
255
258
|
- spec/unit/htty/preferences_spec.rb
|
|
259
|
+
- spec/unit/htty/request_follow_spec.rb
|
|
256
260
|
- spec/unit/htty/request_spec.rb
|
|
261
|
+
- spec/unit/htty/request_userinfo_spec.rb
|
|
257
262
|
- spec/unit/htty/response_spec.rb
|
|
258
263
|
- spec/unit/htty/session_spec.rb
|
|
264
|
+
- spec/unit/htty/shared_examples_for_requests.rb
|
|
265
|
+
- spec/unit/htty/url_escaping.rb
|
|
259
266
|
- spec/unit/htty/version_spec.rb
|
|
260
|
-
homepage: http://htty.github.
|
|
267
|
+
homepage: http://htty.github.io
|
|
261
268
|
licenses:
|
|
262
269
|
- MIT
|
|
270
|
+
metadata: {}
|
|
263
271
|
post_install_message:
|
|
264
272
|
rdoc_options: []
|
|
265
273
|
require_paths:
|
|
266
274
|
- lib
|
|
267
275
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
268
|
-
none: false
|
|
269
276
|
requirements:
|
|
270
|
-
- -
|
|
277
|
+
- - '>='
|
|
271
278
|
- !ruby/object:Gem::Version
|
|
272
279
|
version: 1.8.7
|
|
273
280
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
274
|
-
none: false
|
|
275
281
|
requirements:
|
|
276
|
-
- -
|
|
282
|
+
- - '>='
|
|
277
283
|
- !ruby/object:Gem::Version
|
|
278
284
|
version: '0'
|
|
279
|
-
segments:
|
|
280
|
-
- 0
|
|
281
|
-
hash: 3927749428844555458
|
|
282
285
|
requirements: []
|
|
283
286
|
rubyforge_project: htty
|
|
284
|
-
rubygems_version:
|
|
287
|
+
rubygems_version: 2.2.2
|
|
285
288
|
signing_key:
|
|
286
|
-
specification_version:
|
|
289
|
+
specification_version: 4
|
|
287
290
|
summary: The HTTP TTY
|
|
288
291
|
test_files:
|
|
289
292
|
- spec/integration/htty/cli/commands/query_add_spec.rb
|
|
290
293
|
- spec/integration/htty/cli/commands/query_remove_spec.rb
|
|
291
294
|
- spec/integration/htty/cli/commands/query_set_spec.rb
|
|
292
295
|
- spec/integration/htty/cli/commands/query_unset_spec.rb
|
|
296
|
+
- spec/spec_helper.rb
|
|
293
297
|
- spec/unit/htty/cli/commands/address_spec.rb
|
|
294
298
|
- spec/unit/htty/cli/commands/body_clear_spec.rb
|
|
299
|
+
- spec/unit/htty/cli/commands/body_edit_spec.rb
|
|
295
300
|
- spec/unit/htty/cli/commands/body_request_spec.rb
|
|
296
301
|
- spec/unit/htty/cli/commands/body_response_spec.rb
|
|
297
302
|
- spec/unit/htty/cli/commands/body_set_spec.rb
|
|
@@ -351,6 +356,7 @@ test_files:
|
|
|
351
356
|
- spec/unit/htty/cli/commands/quit_spec.rb
|
|
352
357
|
- spec/unit/htty/cli/commands/reuse_spec.rb
|
|
353
358
|
- spec/unit/htty/cli/commands/scheme_set_spec.rb
|
|
359
|
+
- spec/unit/htty/cli/commands/shared_examples_for_commands.rb
|
|
354
360
|
- spec/unit/htty/cli/commands/ssl_verification_off_spec.rb
|
|
355
361
|
- spec/unit/htty/cli/commands/ssl_verification_on_spec.rb
|
|
356
362
|
- spec/unit/htty/cli/commands/ssl_verification_spec.rb
|
|
@@ -359,11 +365,18 @@ test_files:
|
|
|
359
365
|
- spec/unit/htty/cli/commands/userinfo_clear_spec.rb
|
|
360
366
|
- spec/unit/htty/cli/commands/userinfo_set_spec.rb
|
|
361
367
|
- spec/unit/htty/cli/commands/userinfo_unset_spec.rb
|
|
368
|
+
- spec/unit/htty/cli/display_spec.rb
|
|
362
369
|
- spec/unit/htty/cli_spec.rb
|
|
363
|
-
- spec/unit/htty/
|
|
370
|
+
- spec/unit/htty/command.rb
|
|
371
|
+
- spec/unit/htty/headers_spec.rb
|
|
372
|
+
- spec/unit/htty/payload_spec.rb
|
|
364
373
|
- spec/unit/htty/preferences_spec.rb
|
|
374
|
+
- spec/unit/htty/request_follow_spec.rb
|
|
365
375
|
- spec/unit/htty/request_spec.rb
|
|
376
|
+
- spec/unit/htty/request_userinfo_spec.rb
|
|
366
377
|
- spec/unit/htty/response_spec.rb
|
|
367
378
|
- spec/unit/htty/session_spec.rb
|
|
379
|
+
- spec/unit/htty/shared_examples_for_requests.rb
|
|
380
|
+
- spec/unit/htty/url_escaping.rb
|
|
368
381
|
- spec/unit/htty/version_spec.rb
|
|
369
382
|
has_rdoc: true
|
data/lib/htty/ordered_hash.rb
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
module HTTY; end
|
|
2
|
-
|
|
3
|
-
# Represents a Hash that preserves the insertion order of values. This class
|
|
4
|
-
# exists because Hash did not have this behavior in Ruby v1.8.7 and earlier.
|
|
5
|
-
class HTTY::OrderedHash
|
|
6
|
-
|
|
7
|
-
def initialize(hash={})
|
|
8
|
-
@inner_hash = {}
|
|
9
|
-
hash.each_pair do |key, value|
|
|
10
|
-
@inner_hash[key] = value
|
|
11
|
-
end
|
|
12
|
-
@inner_keys = []
|
|
13
|
-
@inner_hash.each_key do |k|
|
|
14
|
-
@inner_keys << k
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# @private
|
|
19
|
-
def initialize_copy(source)
|
|
20
|
-
super
|
|
21
|
-
@inner_hash = @inner_hash.dup
|
|
22
|
-
@inner_keys = @inner_keys.dup
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
def [](key)
|
|
26
|
-
@inner_hash[key]
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def []=(key, value)
|
|
30
|
-
@inner_keys << key unless @inner_hash.key?(key)
|
|
31
|
-
@inner_hash[key] = value
|
|
32
|
-
self
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def ==(other_hash)
|
|
36
|
-
if other_hash.kind_of?(self.class)
|
|
37
|
-
return (other_hash.instance_variable_get('@inner_hash') == @inner_hash) &&
|
|
38
|
-
(other_hash.instance_variable_get('@inner_keys') == @inner_keys)
|
|
39
|
-
end
|
|
40
|
-
if other_hash.kind_of?(@inner_hash.class)
|
|
41
|
-
return other_hash.keys.all? do |k|
|
|
42
|
-
other_hash[k] == @inner_hash[k]
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
false
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def clear
|
|
49
|
-
@inner_hash.clear
|
|
50
|
-
@inner_keys.clear
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def delete(key)
|
|
54
|
-
@inner_keys.delete(key) if @inner_hash.key?(key)
|
|
55
|
-
@inner_hash.delete key
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
def empty?
|
|
59
|
-
@inner_hash.empty?
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def to_a
|
|
63
|
-
@inner_keys.inject([]) do |result, key|
|
|
64
|
-
result + [[key, @inner_hash[key]]]
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
end
|