htty 1.0.0 → 1.1.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.
- data/History.markdown +21 -0
- data/MIT-LICENSE.markdown +10 -0
- data/README.markdown +238 -0
- data/VERSION +1 -1
- data/bin/htty +1 -1
- data/{app → lib}/htty.rb +0 -2
- data/{app → lib}/htty/cli.rb +11 -4
- data/{app → lib}/htty/cli/command.rb +25 -3
- data/{app → lib}/htty/cli/commands.rb +0 -2
- data/{app → lib}/htty/cli/commands/address.rb +15 -9
- data/{app → lib}/htty/cli/commands/body_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/body_request.rb +1 -3
- data/{app → lib}/htty/cli/commands/body_response.rb +1 -3
- data/{app → lib}/htty/cli/commands/body_set.rb +9 -4
- data/{app → lib}/htty/cli/commands/body_unset.rb +1 -3
- data/{app → lib}/htty/cli/commands/cd.rb +0 -2
- data/{app → lib}/htty/cli/commands/cookie_add.rb +0 -2
- data/{app → lib}/htty/cli/commands/cookie_remove.rb +0 -2
- data/{app → lib}/htty/cli/commands/cookies.rb +9 -5
- data/{app → lib}/htty/cli/commands/cookies_add.rb +1 -3
- data/{app → lib}/htty/cli/commands/cookies_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/cookies_remove.rb +1 -3
- data/{app → lib}/htty/cli/commands/cookies_remove_all.rb +1 -3
- data/{app → lib}/htty/cli/commands/cookies_use.rb +11 -4
- data/{app → lib}/htty/cli/commands/delete.rb +0 -2
- data/{app → lib}/htty/cli/commands/exit.rb +0 -2
- data/{app → lib}/htty/cli/commands/follow.rb +6 -9
- data/{app → lib}/htty/cli/commands/form.rb +0 -2
- data/{app → lib}/htty/cli/commands/form_add.rb +0 -2
- data/{app → lib}/htty/cli/commands/form_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/form_remove.rb +0 -2
- data/{app → lib}/htty/cli/commands/form_remove_all.rb +0 -2
- data/{app → lib}/htty/cli/commands/fragment_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/fragment_set.rb +6 -4
- data/{app → lib}/htty/cli/commands/fragment_unset.rb +4 -4
- data/{app → lib}/htty/cli/commands/get.rb +0 -2
- data/{app → lib}/htty/cli/commands/header_set.rb +0 -2
- data/{app → lib}/htty/cli/commands/header_unset.rb +0 -2
- data/{app → lib}/htty/cli/commands/headers_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/headers_request.rb +13 -8
- data/{app → lib}/htty/cli/commands/headers_response.rb +6 -4
- data/{app → lib}/htty/cli/commands/headers_set.rb +1 -3
- data/{app → lib}/htty/cli/commands/headers_unset.rb +1 -4
- data/{app → lib}/htty/cli/commands/headers_unset_all.rb +1 -3
- data/{app → lib}/htty/cli/commands/help.rb +8 -4
- data/{app → lib}/htty/cli/commands/history.rb +5 -7
- data/{app → lib}/htty/cli/commands/history_verbose.rb +6 -5
- data/{app → lib}/htty/cli/commands/host_set.rb +2 -7
- data/{app → lib}/htty/cli/commands/http_delete.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_get.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_head.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_options.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_post.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_put.rb +0 -2
- data/{app → lib}/htty/cli/commands/http_trace.rb +0 -2
- data/{app → lib}/htty/cli/commands/path_set.rb +6 -4
- data/{app → lib}/htty/cli/commands/port_set.rb +4 -4
- data/{app → lib}/htty/cli/commands/post.rb +0 -2
- data/{app → lib}/htty/cli/commands/put.rb +0 -2
- data/{app → lib}/htty/cli/commands/query_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/query_set.rb +10 -7
- data/{app → lib}/htty/cli/commands/query_unset.rb +12 -6
- data/{app → lib}/htty/cli/commands/query_unset_all.rb +4 -4
- data/{app → lib}/htty/cli/commands/quit.rb +0 -2
- data/{app → lib}/htty/cli/commands/reuse.rb +4 -3
- data/{app → lib}/htty/cli/commands/scheme_set.rb +4 -4
- data/{app → lib}/htty/cli/commands/status.rb +8 -5
- data/{app → lib}/htty/cli/commands/undo.rb +0 -2
- data/{app → lib}/htty/cli/commands/userinfo_clear.rb +0 -2
- data/{app → lib}/htty/cli/commands/userinfo_set.rb +30 -8
- data/{app → lib}/htty/cli/commands/userinfo_unset.rb +4 -4
- data/{app → lib}/htty/cli/display.rb +40 -19
- data/{app → lib}/htty/cli/http_method_command.rb +4 -8
- data/{app → lib}/htty/cli/url_escaping.rb +0 -2
- data/{app → lib}/htty/cookies_util.rb +0 -2
- data/{app → lib}/htty/no_location_header_error.rb +3 -2
- data/{app → lib}/htty/no_response_error.rb +0 -2
- data/{app → lib}/htty/no_set_cookie_header_error.rb +3 -2
- data/{app → lib}/htty/ordered_hash.rb +2 -3
- data/{app → lib}/htty/payload.rb +2 -3
- data/{app → lib}/htty/request.rb +25 -15
- data/{app → lib}/htty/requests_util.rb +2 -3
- data/{app → lib}/htty/response.rb +2 -3
- data/{app → lib}/htty/session.rb +0 -2
- data/spec/unit/htty/cli_spec.rb +9 -14
- data/spec/unit/htty/ordered_hash_spec.rb +13 -17
- data/spec/unit/htty/request_spec.rb +281 -127
- data/spec/unit/htty/session_spec.rb +4 -7
- metadata +152 -99
- data/MIT-LICENSE.rdoc +0 -9
- data/README.rdoc +0 -199
- data/app/htty/cli/cookie_clearing_command.rb +0 -26
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::BodyResponse.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../../no_response_error")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/body_request")
|
|
@@ -35,7 +33,7 @@ class HTTY::CLI::Commands::BodyResponse < HTTY::CLI::Command
|
|
|
35
33
|
# Returns the extended help text for the _body-response_ command.
|
|
36
34
|
def self.help_extended
|
|
37
35
|
'Displays the body content received in the response. Does not ' +
|
|
38
|
-
'communicate with the
|
|
36
|
+
'communicate with the host.'
|
|
39
37
|
end
|
|
40
38
|
|
|
41
39
|
# Returns related command classes for the _body-response_ command.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::BodySet.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
2
|
+
require File.expand_path("#{File.dirname __FILE__}/../display")
|
|
4
3
|
require File.expand_path("#{File.dirname __FILE__}/body_request")
|
|
5
4
|
require File.expand_path("#{File.dirname __FILE__}/body_unset")
|
|
6
5
|
|
|
@@ -13,6 +12,8 @@ module HTTY::CLI::Commands; end
|
|
|
13
12
|
# Encapsulates the _body-set_ command.
|
|
14
13
|
class HTTY::CLI::Commands::BodySet < HTTY::CLI::Command
|
|
15
14
|
|
|
15
|
+
include HTTY::CLI::Display
|
|
16
|
+
|
|
16
17
|
# Returns the name of a category under which help for the _body-set_ command
|
|
17
18
|
# should appear.
|
|
18
19
|
def self.category
|
|
@@ -27,7 +28,7 @@ class HTTY::CLI::Commands::BodySet < HTTY::CLI::Command
|
|
|
27
28
|
# Returns the extended help text for the _body-set_ command.
|
|
28
29
|
def self.help_extended
|
|
29
30
|
'Sets the body content used for the request. Does not communicate with ' +
|
|
30
|
-
"the
|
|
31
|
+
"the host.\n" +
|
|
31
32
|
"\n" +
|
|
32
33
|
'Hit Return three times in a row to signify the end of the body.'
|
|
33
34
|
end
|
|
@@ -40,10 +41,14 @@ class HTTY::CLI::Commands::BodySet < HTTY::CLI::Command
|
|
|
40
41
|
# Performs the _body-set_ command.
|
|
41
42
|
def perform
|
|
42
43
|
add_request_if_has_response do |request|
|
|
44
|
+
puts notice('Hit Return three times to signify the end of the body')
|
|
43
45
|
lines = []
|
|
44
46
|
empty_line_count = 0
|
|
45
47
|
while empty_line_count < 2 do
|
|
46
|
-
|
|
48
|
+
if (input = $stdin.gets).nil?
|
|
49
|
+
break
|
|
50
|
+
end
|
|
51
|
+
lines << input.chomp
|
|
47
52
|
empty_line_count = lines.last.empty? ? (empty_line_count + 1) : 0
|
|
48
53
|
end
|
|
49
54
|
request.body_set lines.join("\n").gsub(/[\r\n]+$/, '')
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::BodyUnset.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/body_request")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/body_set")
|
|
@@ -27,7 +25,7 @@ class HTTY::CLI::Commands::BodyUnset < HTTY::CLI::Command
|
|
|
27
25
|
# Returns the extended help text for the _body-unset_ command.
|
|
28
26
|
def self.help_extended
|
|
29
27
|
'Clears the body content used for the request. Does not communicate with ' +
|
|
30
|
-
'the
|
|
28
|
+
'the host.'
|
|
31
29
|
end
|
|
32
30
|
|
|
33
31
|
# Returns related command classes for the _body-unset_ command.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
require File.expand_path("#{File.dirname __FILE__}/../../request")
|
|
3
2
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../display")
|
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/cookies_add")
|
|
5
5
|
require File.expand_path("#{File.dirname __FILE__}/cookies_remove")
|
|
6
6
|
require File.expand_path("#{File.dirname __FILE__}/cookies_remove_all")
|
|
@@ -17,6 +17,8 @@ module HTTY::CLI::Commands; end
|
|
|
17
17
|
# Encapsulates the _cookies_ command.
|
|
18
18
|
class HTTY::CLI::Commands::Cookies < HTTY::CLI::Command
|
|
19
19
|
|
|
20
|
+
include HTTY::CLI::Display
|
|
21
|
+
|
|
20
22
|
# Returns the name of a category under which help for the _cookies_ command
|
|
21
23
|
# should appear.
|
|
22
24
|
def self.category
|
|
@@ -31,10 +33,12 @@ class HTTY::CLI::Commands::Cookies < HTTY::CLI::Command
|
|
|
31
33
|
# Returns the extended help text for the _cookies_ command.
|
|
32
34
|
def self.help_extended
|
|
33
35
|
'Displays the cookies used for the request. Does not communicate with ' +
|
|
34
|
-
"the
|
|
36
|
+
"the host.\n" +
|
|
35
37
|
"\n" +
|
|
36
|
-
"This command displays cookies extracted from the request's
|
|
37
|
-
"header, which is nevertheless
|
|
38
|
+
"This command displays cookies extracted from the request's " +
|
|
39
|
+
"'#{HTTY::Request::COOKIES_HEADER_NAME}' header, which is nevertheless " +
|
|
40
|
+
'shown when you type ' +
|
|
41
|
+
"#{strong HTTY::CLI::Commands::HeadersRequest.command_line}.\n" +
|
|
38
42
|
"\n" +
|
|
39
43
|
'Cookies are not required to have unique names. You can add multiple ' +
|
|
40
44
|
'cookies with the same name, and they will be removed in ' +
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::CookiesAdd.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/cookies")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/cookies_remove")
|
|
@@ -35,7 +33,7 @@ class HTTY::CLI::Commands::CookiesAdd < HTTY::CLI::Command
|
|
|
35
33
|
# Returns the extended help text for the _cookies-add_ command.
|
|
36
34
|
def self.help_extended
|
|
37
35
|
'Adds a cookie used for the request. Does not communicate with the ' +
|
|
38
|
-
"
|
|
36
|
+
"host.\n" +
|
|
39
37
|
"\n" +
|
|
40
38
|
'Cookies are not required to have unique names. You can add multiple ' +
|
|
41
39
|
'cookies with the same name, and they will be removed in ' +
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::CookiesRemove.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/cookies")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/cookies_add")
|
|
@@ -35,7 +33,7 @@ class HTTY::CLI::Commands::CookiesRemove < HTTY::CLI::Command
|
|
|
35
33
|
# Returns the extended help text for the _cookies-remove_ command.
|
|
36
34
|
def self.help_extended
|
|
37
35
|
'Removes a cookie used for the request. Does not communicate with the ' +
|
|
38
|
-
"
|
|
36
|
+
"host.\n" +
|
|
39
37
|
"\n" +
|
|
40
38
|
'Cookies are not required to have unique names. You can add multiple ' +
|
|
41
39
|
'cookies with the same name, and they will be removed in ' +
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::CookiesRemoveAll.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/cookies")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/cookies_add")
|
|
@@ -29,7 +27,7 @@ class HTTY::CLI::Commands::CookiesRemoveAll < HTTY::CLI::Command
|
|
|
29
27
|
# Returns the extended help text for the _cookies-remove-all_ command.
|
|
30
28
|
def self.help_extended
|
|
31
29
|
'Removes all cookies used for the request. Does not communicate with the ' +
|
|
32
|
-
'
|
|
30
|
+
'host.'
|
|
33
31
|
end
|
|
34
32
|
|
|
35
33
|
# Returns related command classes for the _cookies-remove-all_ command.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
require File.expand_path("#{File.dirname __FILE__}/../../response")
|
|
3
2
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
3
|
+
require File.expand_path("#{File.dirname __FILE__}/../display")
|
|
4
4
|
require File.expand_path("#{File.dirname __FILE__}/cookies")
|
|
5
5
|
require File.expand_path("#{File.dirname __FILE__}/cookies_add")
|
|
6
6
|
require File.expand_path("#{File.dirname __FILE__}/cookies_remove")
|
|
@@ -16,6 +16,8 @@ module HTTY::CLI::Commands; end
|
|
|
16
16
|
# Encapsulates the _cookies-use_ command.
|
|
17
17
|
class HTTY::CLI::Commands::CookiesUse < HTTY::CLI::Command
|
|
18
18
|
|
|
19
|
+
include HTTY::CLI::Display
|
|
20
|
+
|
|
19
21
|
# Returns the name of a category under which help for the _cookies-use_
|
|
20
22
|
# command should appear.
|
|
21
23
|
def self.category
|
|
@@ -30,7 +32,8 @@ class HTTY::CLI::Commands::CookiesUse < HTTY::CLI::Command
|
|
|
30
32
|
# Returns the extended help text for the _cookies-use_ command.
|
|
31
33
|
def self.help_extended
|
|
32
34
|
'Sets the cookies of the request to the cookies offered in the response ' +
|
|
33
|
-
"(the '
|
|
35
|
+
"(the '#{HTTY::Response::COOKIES_HEADER_NAME}' header). Does not " +
|
|
36
|
+
'communicate with the host.'
|
|
34
37
|
end
|
|
35
38
|
|
|
36
39
|
# Returns related command classes for the _cookies-use_ command.
|
|
@@ -50,7 +53,11 @@ class HTTY::CLI::Commands::CookiesUse < HTTY::CLI::Command
|
|
|
50
53
|
end
|
|
51
54
|
|
|
52
55
|
add_request_if_has_response do |request|
|
|
53
|
-
request.cookies_use
|
|
56
|
+
changed_request = request.cookies_use(session.last_response)
|
|
57
|
+
phrase = pluralize('cookie', changed_request.cookies.length)
|
|
58
|
+
phrase = phrase[0..0].upcase + phrase[1..-1]
|
|
59
|
+
puts notice("#{phrase} now in use")
|
|
60
|
+
changed_request
|
|
54
61
|
end
|
|
55
62
|
end
|
|
56
63
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
1
|
+
require File.expand_path("#{File.dirname __FILE__}/../../response")
|
|
3
2
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
|
-
require File.expand_path("#{File.dirname __FILE__}/../cookie_clearing_command")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/address")
|
|
6
4
|
require File.expand_path("#{File.dirname __FILE__}/http_get")
|
|
7
5
|
|
|
@@ -14,8 +12,6 @@ module HTTY::CLI::Commands; end
|
|
|
14
12
|
# Encapsulates the _follow_ command.
|
|
15
13
|
class HTTY::CLI::Commands::Follow < HTTY::CLI::Command
|
|
16
14
|
|
|
17
|
-
include HTTY::CLI::CookieClearingCommand
|
|
18
|
-
|
|
19
15
|
# Returns the name of a category under which help for the _follow_ command
|
|
20
16
|
# should appear.
|
|
21
17
|
def self.category
|
|
@@ -25,13 +21,14 @@ class HTTY::CLI::Commands::Follow < HTTY::CLI::Command
|
|
|
25
21
|
# Returns the help text for the _follow_ command.
|
|
26
22
|
def self.help
|
|
27
23
|
"Changes the address of the request to the value of the response's " +
|
|
28
|
-
"'
|
|
24
|
+
"'#{HTTY::Response::LOCATION_HEADER_NAME}' header"
|
|
29
25
|
end
|
|
30
26
|
|
|
31
27
|
# Returns the extended help text for the _follow_ command.
|
|
32
28
|
def self.help_extended
|
|
33
|
-
"Changes the address of the request to the value of the response's "
|
|
34
|
-
"'
|
|
29
|
+
"Changes the address of the request to the value of the response's " +
|
|
30
|
+
"'#{HTTY::Response::LOCATION_HEADER_NAME}' header. Does not communicate " +
|
|
31
|
+
'with the host.'
|
|
35
32
|
end
|
|
36
33
|
|
|
37
34
|
# Returns related command classes for the _follow_ command.
|
|
@@ -47,7 +44,7 @@ class HTTY::CLI::Commands::Follow < HTTY::CLI::Command
|
|
|
47
44
|
end
|
|
48
45
|
|
|
49
46
|
add_request_if_has_response do |request|
|
|
50
|
-
notify_if_cookies_cleared request do
|
|
47
|
+
self.class.notify_if_cookies_cleared request do
|
|
51
48
|
request.follow session.last_response
|
|
52
49
|
end
|
|
53
50
|
end
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::FragmentSet.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/../url_escaping")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/address")
|
|
@@ -35,7 +33,9 @@ class HTTY::CLI::Commands::FragmentSet < HTTY::CLI::Command
|
|
|
35
33
|
# Returns the extended help text for the _fragment-set_ command.
|
|
36
34
|
def self.help_extended
|
|
37
35
|
'Sets the page fragment used for the request. Does not communicate with ' +
|
|
38
|
-
"the
|
|
36
|
+
"the host.\n" +
|
|
37
|
+
"\n" +
|
|
38
|
+
"The page fragment will be URL-encoded if necessary.\n" +
|
|
39
39
|
"\n" +
|
|
40
40
|
'The console prompt shows the address for the current request.'
|
|
41
41
|
end
|
|
@@ -52,7 +52,9 @@ class HTTY::CLI::Commands::FragmentSet < HTTY::CLI::Command
|
|
|
52
52
|
clean_arguments = arguments.collect do |a|
|
|
53
53
|
a.gsub(/^#/, '')
|
|
54
54
|
end
|
|
55
|
-
request
|
|
55
|
+
self.class.notify_if_cookies_cleared request do
|
|
56
|
+
request.fragment_set(*escape_or_warn_of_escape_sequences(clean_arguments))
|
|
57
|
+
end
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::FragmentUnset.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/address")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/fragment_set")
|
|
@@ -27,7 +25,7 @@ class HTTY::CLI::Commands::FragmentUnset < HTTY::CLI::Command
|
|
|
27
25
|
# Returns the extended help text for the _fragment-unset_ command.
|
|
28
26
|
def self.help_extended
|
|
29
27
|
'Removes the page fragment used for the request. Does not communicate ' +
|
|
30
|
-
"with the
|
|
28
|
+
"with the host.\n" +
|
|
31
29
|
"\n" +
|
|
32
30
|
'The console prompt shows the address for the current request.'
|
|
33
31
|
end
|
|
@@ -41,7 +39,9 @@ class HTTY::CLI::Commands::FragmentUnset < HTTY::CLI::Command
|
|
|
41
39
|
# Performs the _fragment-unset_ command.
|
|
42
40
|
def perform
|
|
43
41
|
add_request_if_has_response do |request|
|
|
44
|
-
request
|
|
42
|
+
self.class.notify_if_cookies_cleared request do
|
|
43
|
+
request.fragment_unset(*arguments)
|
|
44
|
+
end
|
|
45
45
|
end
|
|
46
46
|
end
|
|
47
47
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::HeadersRequest.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../../request")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/../display")
|
|
@@ -34,11 +32,16 @@ class HTTY::CLI::Commands::HeadersRequest < HTTY::CLI::Command
|
|
|
34
32
|
|
|
35
33
|
# Returns the extended help text for the _headers-request_ command.
|
|
36
34
|
def self.help_extended
|
|
37
|
-
'Displays the headers used for the request. Does not communicate with '
|
|
38
|
-
"the
|
|
39
|
-
"\n"
|
|
40
|
-
'Headers must have unique names. When you set a header that already '
|
|
41
|
-
|
|
35
|
+
'Displays the headers used for the request. Does not communicate with ' +
|
|
36
|
+
"the host.\n" +
|
|
37
|
+
"\n" +
|
|
38
|
+
'Headers must have unique names. When you set a header that already ' +
|
|
39
|
+
"exists, its value will be changed.\n" +
|
|
40
|
+
"\n" +
|
|
41
|
+
"A '#{HTTY::Request::COOKIES_HEADER_NAME}' request header is marked with " +
|
|
42
|
+
'a bold asterisk (it looks like a cookie). Similarly, an ' +
|
|
43
|
+
"'#{HTTY::Request::AUTHORIZATION_HEADER_NAME}' request header is marked " +
|
|
44
|
+
"with a bold mercantile symbol ('@')."
|
|
42
45
|
end
|
|
43
46
|
|
|
44
47
|
# Returns related command classes for the _headers-request_ command.
|
|
@@ -63,7 +66,9 @@ class HTTY::CLI::Commands::HeadersRequest < HTTY::CLI::Command
|
|
|
63
66
|
else
|
|
64
67
|
request.headers
|
|
65
68
|
end
|
|
66
|
-
show_headers headers,
|
|
69
|
+
show_headers headers,
|
|
70
|
+
:show_asterisk_next_to => HTTY::Request::COOKIES_HEADER_NAME,
|
|
71
|
+
:show_mercantile_next_to => HTTY::Request::AUTHORIZATION_HEADER_NAME
|
|
67
72
|
self
|
|
68
73
|
end
|
|
69
74
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
# Defines HTTY::CLI::Commands::HeadersResponse.
|
|
2
|
-
|
|
3
1
|
require File.expand_path("#{File.dirname __FILE__}/../../response")
|
|
4
2
|
require File.expand_path("#{File.dirname __FILE__}/../../no_response_error")
|
|
5
3
|
require File.expand_path("#{File.dirname __FILE__}/../command")
|
|
@@ -41,7 +39,10 @@ class HTTY::CLI::Commands::HeadersResponse < HTTY::CLI::Command
|
|
|
41
39
|
# Returns the extended help text for the _headers-response_ command.
|
|
42
40
|
def self.help_extended
|
|
43
41
|
'Displays the headers received in the response. Does not communicate ' +
|
|
44
|
-
|
|
42
|
+
"with the host.\n" +
|
|
43
|
+
"\n" +
|
|
44
|
+
"A '#{HTTY::Response::COOKIES_HEADER_NAME}' request header is marked " +
|
|
45
|
+
'with a bold asterisk (it looks like a cookie).'
|
|
45
46
|
end
|
|
46
47
|
|
|
47
48
|
# Returns related command classes for the _headers-response_ command.
|
|
@@ -58,7 +59,8 @@ class HTTY::CLI::Commands::HeadersResponse < HTTY::CLI::Command
|
|
|
58
59
|
unless (response = session.last_response)
|
|
59
60
|
raise HTTY::NoResponseError
|
|
60
61
|
end
|
|
61
|
-
show_headers response.headers,
|
|
62
|
+
show_headers response.headers,
|
|
63
|
+
:show_asterisk_next_to => HTTY::Response::COOKIES_HEADER_NAME
|
|
62
64
|
self
|
|
63
65
|
end
|
|
64
66
|
|