Class: HTTY::CLI::Commands::HeadersRequest
- Inherits:
-
HTTY::CLI::Command
- Object
- HTTY::CLI::Command
- HTTY::CLI::Commands::HeadersRequest
- Includes:
- Display
- Defined in:
- lib/htty/cli/commands/headers_request.rb
Overview
Encapsulates the headers-request command.
Constant Summary
Constants included from Display
Instance Attribute Summary
Attributes inherited from HTTY::CLI::Command
Class Method Summary collapse
-
.category ⇒ Object
Returns the name of a category under which help for the headers-request command should appear.
-
.help ⇒ Object
Returns the help text for the headers-request command.
-
.help_extended ⇒ Object
Returns the extended help text for the headers-request command.
-
.see_also_commands ⇒ Object
Returns related command classes for the headers-request command.
Instance Method Summary collapse
-
#perform ⇒ Object
Performs the headers-request command.
Methods included from Display
#break, #format, #formatted_prompt_for, #indent, #logotype, #normal, #notice, #pluralize, #rescuing_from, #say, #say_goodbye, #say_header, #say_hello, #show_headers, #show_request, #show_response, #strong, #word_wrap, #word_wrap_indented
Methods inherited from HTTY::CLI::Command
#add_request_if_new, alias_for, aliases, build_for, command_line, command_line_arguments, complete_for?, #initialize, notify_if_cookies_cleared, raw_name, sanitize_arguments
Constructor Details
This class inherits a constructor from HTTY::CLI::Command
Class Method Details
.category ⇒ Object
Returns the name of a category under which help for the headers-request command should appear.
10 11 12 |
# File 'lib/htty/cli/commands/headers_request.rb', line 10 def self.category 'Building Requests' end |
.help ⇒ Object
Returns the help text for the headers-request command.
15 16 17 |
# File 'lib/htty/cli/commands/headers_request.rb', line 15 def self.help 'Displays the headers of the request' end |
.help_extended ⇒ Object
Returns the extended help text for the headers-request command.
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/htty/cli/commands/headers_request.rb', line 20 def self.help_extended 'Displays the headers used for the request. Does not communicate with ' + "the host.\n" + "\n" + 'Headers must have unique names. When you set a header that already ' + "exists, its value will be changed.\n" + "\n" + "A '#{HTTY::Request::COOKIES_HEADER_NAME}' request header is marked with " + 'a bold asterisk (it looks like a cookie). Similarly, an ' + "'#{HTTY::Request::AUTHORIZATION_HEADER_NAME}' request header is marked " + "with a bold mercantile symbol ('@')." end |
.see_also_commands ⇒ Object
Returns related command classes for the headers-request command.
34 35 36 37 38 39 40 41 |
# File 'lib/htty/cli/commands/headers_request.rb', line 34 def self.see_also_commands [HTTY::CLI::Commands::HeadersSet, HTTY::CLI::Commands::HeadersUnset, HTTY::CLI::Commands::HeadersUnsetAll, HTTY::CLI::Commands::BodyRequest, HTTY::CLI::Commands::Cookies, HTTY::CLI::Commands::HeadersResponse] end |
Instance Method Details
#perform ⇒ Object
Performs the headers-request command.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/htty/cli/commands/headers_request.rb', line 44 def perform request = session.requests.last headers = if request.request_method.nil? if request.body.to_s.length.zero? request.headers false else request.headers true end else request.headers end show_headers headers, :show_asterisk_next_to => HTTY::Request::COOKIES_HEADER_NAME, :show_mercantile_next_to => HTTY::Request::AUTHORIZATION_HEADER_NAME self end |