faraday 0.5.3 → 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -6,10 +6,13 @@ source "http://rubygems.org"
6
6
  group :development, :test do
7
7
  gem 'patron', '~> 0.4'
8
8
  gem 'sinatra', '~> 1.1'
9
- gem 'typhoeus', '~> 0.1'
9
+ gem 'typhoeus', '~> 0.2'
10
10
  gem 'eventmachine', '~> 0.12'
11
11
  gem 'em-http-request', '~> 0.2', :require => 'em-http'
12
- gem 'em-synchrony', '~> 0.2', :require => ['em-synchrony', 'em-synchrony/em-http']
12
+ major, minor, patch = RUBY_VERSION.split('.')
13
+ if major.to_i >= 1 && minor.to_i >= 9
14
+ gem 'em-synchrony', '~> 0.2', :require => ['em-synchrony', 'em-synchrony/em-http']
15
+ end
13
16
  end
14
17
 
15
18
  gemspec
data/faraday.gemspec CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  ## If your rubyforge_project name is different, then edit it and comment out
13
13
  ## the sub! line in the Rakefile
14
14
  s.name = 'faraday'
15
- s.version = '0.5.3'
16
- s.date = '2010-11-09'
15
+ s.version = '0.5.4'
16
+ s.date = '2011-01-11'
17
17
  s.rubyforge_project = 'faraday'
18
18
 
19
19
  ## Make sure your summary is short. The description may be as long
@@ -34,7 +34,7 @@ Gem::Specification.new do |s|
34
34
 
35
35
  s.add_development_dependency('rake', '~> 0.8')
36
36
  s.add_runtime_dependency('addressable', '~> 2.2.2')
37
- s.add_runtime_dependency('multipart-post', '~> 1.0.1')
37
+ s.add_runtime_dependency('multipart-post', '~> 1.1.0')
38
38
  s.add_runtime_dependency('rack', ['>= 1.1.0', "< 2"])
39
39
 
40
40
  ## Leave this section as-is. It will be automatically generated from the
@@ -43,7 +43,6 @@ Gem::Specification.new do |s|
43
43
  # = MANIFEST =
44
44
  s.files = %w[
45
45
  Gemfile
46
- Gemfile.lock
47
46
  LICENSE
48
47
  README.md
49
48
  Rakefile
data/lib/faraday.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Faraday
2
- VERSION = "0.5.3"
2
+ VERSION = "0.5.4"
3
3
 
4
4
  class << self
5
5
  attr_accessor :default_adapter
@@ -10,7 +10,7 @@ module Faraday
10
10
  :ActionDispatch => 'action_dispatch',
11
11
  :NetHttp => 'net_http',
12
12
  :Typhoeus => 'typhoeus',
13
- :EMSynchrony => 'em_synchrony',
13
+ :EMSynchrony => 'em_synchrony',
14
14
  :Patron => 'patron',
15
15
  :Test => 'test'
16
16
 
@@ -20,7 +20,7 @@ module Faraday
20
20
  :net_http => :NetHttp,
21
21
  :typhoeus => :Typhoeus,
22
22
  :patron => :Patron,
23
- :em_synchrnoy => :EMSynchrony
23
+ :em_synchrony => :EMSynchrony
24
24
 
25
25
  def call(env)
26
26
  process_body_for_request(env)
@@ -81,7 +81,9 @@ module Faraday
81
81
  end
82
82
 
83
83
  def basic_auth(login, pass)
84
- @headers['authorization'] = "Basic #{Base64.encode64("#{login}:#{pass}").strip}"
84
+ auth = Base64.encode64("#{login}:#{pass}")
85
+ auth.gsub!("\n", "")
86
+ @headers['authorization'] = "Basic #{auth}"
85
87
  end
86
88
 
87
89
  def token_auth(token, options = {})
data/lib/faraday/error.rb CHANGED
@@ -6,7 +6,9 @@ module Faraday
6
6
  end
7
7
 
8
8
  def message
9
- @inner_exception.message
9
+ @inner_exception.respond_to?(:message) ?
10
+ @inner_exception.message :
11
+ @inner_exception.to_s
10
12
  end
11
13
 
12
14
  def backtrace
@@ -58,6 +58,12 @@ class TestConnection < Faraday::TestCase
58
58
  assert_equal 'Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==', conn.headers['Authorization']
59
59
  end
60
60
 
61
+ def test_long_basic_auth_sets_authorization_header_without_new_lines
62
+ conn = Faraday::Connection.new
63
+ conn.basic_auth "A" * 255, ""
64
+ assert_equal "Basic #{'QUFB' * 85}Og==", conn.headers['Authorization']
65
+ end
66
+
61
67
  def test_auto_parses_basic_auth_from_url
62
68
  conn = Faraday::Connection.new :url => "http://aladdin:opensesame@sushi.com/fish"
63
69
  assert_equal 'Basic YWxhZGRpbjpvcGVuc2VzYW1l', conn.headers['Authorization']
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 3
9
- version: 0.5.3
8
+ - 4
9
+ version: 0.5.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rick Olson
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-11-09 00:00:00 -08:00
17
+ date: 2011-01-11 00:00:00 -08:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -56,9 +56,9 @@ dependencies:
56
56
  - !ruby/object:Gem::Version
57
57
  segments:
58
58
  - 1
59
- - 0
60
59
  - 1
61
- version: 1.0.1
60
+ - 0
61
+ version: 1.1.0
62
62
  type: :runtime
63
63
  version_requirements: *id003
64
64
  - !ruby/object:Gem::Dependency
@@ -91,7 +91,6 @@ extra_rdoc_files: []
91
91
 
92
92
  files:
93
93
  - Gemfile
94
- - Gemfile.lock
95
94
  - LICENSE
96
95
  - README.md
97
96
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,44 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- faraday (0.5.3)
5
- addressable (~> 2.2.2)
6
- multipart-post (~> 1.0.1)
7
- rack (>= 1.1.0, < 2)
8
-
9
- GEM
10
- remote: http://rubygems.org/
11
- specs:
12
- addressable (2.2.2)
13
- em-http-request (0.2.14)
14
- addressable (>= 2.0.0)
15
- eventmachine (>= 0.12.9)
16
- em-synchrony (0.2.0)
17
- eventmachine (>= 0.12.9)
18
- eventmachine (0.12.10)
19
- multipart-post (1.0.1)
20
- patron (0.4.10)
21
- rack (1.2.1)
22
- rake (0.8.7)
23
- sinatra (1.1.0)
24
- rack (~> 1.1)
25
- tilt (~> 1.1)
26
- tilt (1.1)
27
- typhoeus (0.1.31)
28
- rack
29
-
30
- PLATFORMS
31
- ruby
32
-
33
- DEPENDENCIES
34
- addressable (~> 2.2.2)
35
- em-http-request (~> 0.2)
36
- em-synchrony (~> 0.2)
37
- eventmachine (~> 0.12)
38
- faraday!
39
- multipart-post (~> 1.0.1)
40
- patron (~> 0.4)
41
- rack (>= 1.1.0, < 2)
42
- rake (~> 0.8)
43
- sinatra (~> 1.1)
44
- typhoeus (~> 0.1)