lib/ronin/cli/commands/http.rb in ronin-2.0.0.beta4 vs lib/ronin/cli/commands/http.rb in ronin-2.0.0.beta5
- old
+ new
@@ -321,20 +321,26 @@
# The URL to request.
#
def process_value(url)
url = URI(url)
- Support::Network::HTTP.request(
- @http_method, url, proxy: @proxy,
- user_agent: @user_agent,
- user: url.user,
- password: url.password,
- query_params: @query_params,
- headers: @headers,
- body: @body,
- form_data: @form_data,
- &method(:print_response)
- )
+ response = begin
+ Support::Network::HTTP.request(
+ @http_method, url, proxy: @proxy,
+ user_agent: @user_agent,
+ user: url.user,
+ password: url.password,
+ query_params: @query_params,
+ headers: @headers,
+ body: @body,
+ form_data: @form_data
+ )
+ rescue => error
+ print_error(error.message)
+ exit(1)
+ end
+
+ print_response(response)
end
#
# Prints the HTTP response.
#