mirror of
https://github.com/jnunemaker/httparty
synced 2023-03-27 23:23:07 -04:00
Mitigates Style/SpaceAroundOperators
This commit is contained in:
parent
b0db829b36
commit
0e1360e8d3
6 changed files with 13 additions and 13 deletions
|
@ -10,7 +10,7 @@ end
|
|||
# google.com redirects to www.google.com so this is live test for redirection
|
||||
pp Google.get('http://google.com')
|
||||
|
||||
puts '', '*'*70, ''
|
||||
puts '', '*' * 70, ''
|
||||
|
||||
# check that ssl is requesting right
|
||||
pp Google.get('https://www.google.com')
|
||||
|
|
|
@ -8,7 +8,7 @@ my_logger = Logger.new "httparty.log"
|
|||
my_logger.info "Logging can be used on the main HTTParty class. It logs redirects too."
|
||||
HTTParty.get "http://google.com", logger: my_logger
|
||||
|
||||
my_logger.info '*'*70
|
||||
my_logger.info '*' * 70
|
||||
|
||||
my_logger.info "It can be used also on a custom class."
|
||||
|
||||
|
@ -19,14 +19,14 @@ end
|
|||
|
||||
Google.get "http://google.com"
|
||||
|
||||
my_logger.info '*'*70
|
||||
my_logger.info '*' * 70
|
||||
|
||||
my_logger.info "The default formatter is :apache. The :curl formatter can also be used."
|
||||
my_logger.info "You can tell wich method to call on the logger too. It is info by default."
|
||||
HTTParty.get "http://google.com", logger: my_logger, log_level: :debug, log_format: :curl
|
||||
|
||||
|
||||
my_logger.info '*'*70
|
||||
my_logger.info '*' * 70
|
||||
|
||||
my_logger.info "These configs are also available on custom classes."
|
||||
class Google
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'httparty/logger/curl_logger'
|
|||
module HTTParty
|
||||
module Logger
|
||||
def self.build(logger, level, formatter)
|
||||
level ||= :info
|
||||
level ||= :info
|
||||
formatter ||= :apache
|
||||
|
||||
case formatter
|
||||
|
|
|
@ -338,7 +338,7 @@ RSpec.describe HTTParty::Request do
|
|||
end
|
||||
|
||||
it 'should handle csv automatically' do
|
||||
csv=['"id","Name"','"1234","Foo Bar!"'].join("\n")
|
||||
csv = ['"id","Name"','"1234","Foo Bar!"'].join("\n")
|
||||
@request.options[:format] = :csv
|
||||
expect(@request.send(:parse_response, csv)).to eq([%w(id Name),["1234","Foo Bar!"]])
|
||||
end
|
||||
|
@ -599,14 +599,14 @@ RSpec.describe HTTParty::Request do
|
|||
end
|
||||
|
||||
it 'should update cookies with rediects' do
|
||||
@request.options[:headers] = {'Cookie'=> 'foo=bar;'}
|
||||
@request.options[:headers] = {'Cookie' => 'foo=bar;'}
|
||||
@redirect['Set-Cookie'] = 'foo=tar;'
|
||||
@request.perform
|
||||
expect(@request.options[:headers]['Cookie']).to match(/foo=tar/)
|
||||
end
|
||||
|
||||
it 'should keep cookies between rediects' do
|
||||
@request.options[:headers] = {'Cookie'=> 'keep=me'}
|
||||
@request.options[:headers] = {'Cookie' => 'keep=me'}
|
||||
@redirect['Set-Cookie'] = 'foo=tar;'
|
||||
@request.perform
|
||||
expect(@request.options[:headers]['Cookie']).to match(/keep=me/)
|
||||
|
@ -719,14 +719,14 @@ RSpec.describe HTTParty::Request do
|
|||
end
|
||||
|
||||
it 'should update cookies with rediects' do
|
||||
@request.options[:headers] = {'Cookie'=> 'foo=bar;'}
|
||||
@request.options[:headers] = {'Cookie' => 'foo=bar;'}
|
||||
@redirect['Set-Cookie'] = 'foo=tar;'
|
||||
@request.perform
|
||||
expect(@request.options[:headers]['Cookie']).to match(/foo=tar/)
|
||||
end
|
||||
|
||||
it 'should keep cookies between rediects' do
|
||||
@request.options[:headers] = {'Cookie'=> 'keep=me'}
|
||||
@request.options[:headers] = {'Cookie' => 'keep=me'}
|
||||
@redirect['Set-Cookie'] = 'foo=tar;'
|
||||
@request.perform
|
||||
expect(@request.options[:headers]['Cookie']).to match(/keep=me/)
|
||||
|
|
|
@ -743,7 +743,7 @@ RSpec.describe HTTParty do
|
|||
it "should not get undefined method add_node for nil class for the following xml" do
|
||||
stub_http_response_with('undefined_method_add_node_for_nil.xml')
|
||||
result = HTTParty.get('http://foobar.com')
|
||||
expect(result.parsed_response).to eq({"Entities"=>{"href"=>"https://s3-sandbox.parature.com/api/v1/5578/5633/Account", "results"=>"0", "total"=>"0", "page_size"=>"25", "page"=>"1"}})
|
||||
expect(result.parsed_response).to eq({"Entities" => {"href" => "https://s3-sandbox.parature.com/api/v1/5578/5633/Account", "results" => "0", "total" => "0", "page_size" => "25", "page" => "1"}})
|
||||
end
|
||||
|
||||
it "should parse empty response fine" do
|
||||
|
|
|
@ -24,7 +24,7 @@ class SSLTestServer
|
|||
@raw_server = TCPServer.new(@port)
|
||||
|
||||
if @port == 0
|
||||
@port = Socket::getnameinfo(@raw_server.getsockname, Socket::NI_NUMERICHOST|Socket::NI_NUMERICSERV)[1].to_i
|
||||
@port = Socket::getnameinfo(@raw_server.getsockname, Socket::NI_NUMERICHOST | Socket::NI_NUMERICSERV)[1].to_i
|
||||
end
|
||||
|
||||
@ssl_server = OpenSSL::SSL::SSLServer.new(@raw_server, @ctx)
|
||||
|
@ -62,7 +62,7 @@ class SSLTestServer
|
|||
header << line
|
||||
end
|
||||
|
||||
response =<<EOF
|
||||
response = <<EOF
|
||||
HTTP/1.1 200 OK
|
||||
Connection: close
|
||||
Content-Type: application/json; charset=UTF-8
|
||||
|
|
Loading…
Add table
Reference in a new issue