lib/ronin/network/extensions/http/net.rb in ronin-support-0.2.0.rc2 vs lib/ronin/network/extensions/http/net.rb in ronin-support-0.2.0

- old
+ new

@@ -396,31 +396,43 @@ yield resp if block_given? return resp end # - # Performs an HTTP Get request. + # Performs an HTTP Get request and returns the Response Headers. # # @param [Hash] options # Additional options. # - # @yield [response] - # If a block is given, it will be passed the response received from - # the request. + # @return [Hash{String => Array<String>}] + # The Headers of the HTTP response. # - # @yieldparam [Net::HTTP::Response] response - # The HTTP response object. + # @see http_get # + # @since 0.2.0 + # + # @api public + # + def Net.http_get_headers(options={}) + Net.http_get(options).to_hash + end + + # + # Performs an HTTP Get request and returns the Respond Body. + # + # @param [Hash] options + # Additional options. + # # @return [String] # The body of the HTTP response. # - # @see http_request + # @see http_get # # @api public # - def Net.http_get_body(options={},&block) - Net.http_get(options,&block).body + def Net.http_get_body(options={}) + Net.http_get(options).body end # # Performs an HTTP Head request. # @@ -585,33 +597,48 @@ yield resp if block_given? return resp end # - # Performs an HTTP Post request. + # Performs an HTTP Post request and returns the Response Headers. # # @param [Hash] options # Additional options. # # @option options [Hash, String] :form_data # The form data to send with the HTTP Post request. # - # @yield [response] - # If a block is given, it will be passed the response received from - # the request. + # @return [Hash{String => Array<String>}] + # The headers of the HTTP response. # - # @yieldparam [Net::HTTP::Response] response - # The HTTP response object. + # @see http_post # + # @since 0.2.0 + # + # @api public + # + def Net.http_post_headers(options={}) + Net.http_post(options).to_hash + end + + # + # Performs an HTTP Post request and returns the Response Body. + # + # @param [Hash] options + # Additional options. + # + # @option options [Hash, String] :form_data + # The form data to send with the HTTP Post request. + # # @return [String] # The body of the HTTP response. # - # @see http_request + # @see http_post # # @api public # - def Net.http_post_body(options={},&block) - Net.http_post(options,&block).body + def Net.http_post_body(options={}) + Net.http_post(options).body end # # Performs an HTTP Propfind request. #