mirror of
https://github.com/rest-client/rest-client.git
synced 2022-11-09 13:49:40 -05:00
Fix assignments in conditions.
This commit is contained in:
parent
7502ce3e97
commit
39c5b12273
2 changed files with 6 additions and 5 deletions
|
@ -26,10 +26,10 @@ end
|
|||
|
||||
config = YAML.load(File.read(ENV['HOME'] + "/.restclient")) rescue {}
|
||||
|
||||
@url, @username, @password = if c = config[@url]
|
||||
[c['url'], c['username'], c['password']]
|
||||
if (c = config[@url])
|
||||
@url, @username, @password = [c['url'], c['username'], c['password']]
|
||||
else
|
||||
[@url, * ARGV]
|
||||
@url, @username, @password = [@url, * ARGV]
|
||||
end
|
||||
|
||||
usage("invalid url '#{@url}") unless @url =~ /^https?/
|
||||
|
@ -83,7 +83,8 @@ if File.exists? ".irbrc"
|
|||
ENV['IRBRC'] = ".irbrc"
|
||||
end
|
||||
|
||||
if File.exists?(File.expand_path(rcfile = "~/.restclientrc"))
|
||||
rcfile = File.expand_path("~/.restclientrc")
|
||||
if File.exists?(rcfile)
|
||||
load(rcfile)
|
||||
end
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ module RestClient
|
|||
s.write(" filename=\"#{v.respond_to?(:original_filename) ? v.original_filename : File.basename(v.path)}\"#{EOL}")
|
||||
s.write("Content-Type: #{v.respond_to?(:content_type) ? v.content_type : mime_for(v.path)}#{EOL}")
|
||||
s.write(EOL)
|
||||
while data = v.read(8124)
|
||||
while (data = v.read(8124))
|
||||
s.write(data)
|
||||
end
|
||||
ensure
|
||||
|
|
Loading…
Reference in a new issue