Add support for HTTP Basic Authentication#33
Add support for HTTP Basic Authentication#33piotrekbator wants to merge 2 commits intoinf0rmer:masterfrom
Conversation
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) | ||
| api.users(55).get | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [111/80]
| end | ||
|
|
||
| it 'allows setting parameters globally' do | ||
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) |
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) | ||
| end | ||
|
|
||
| it 'allows setting parameters globally' do |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| it 'allows sending parameters in a request' do | ||
| api.users(55).get(basic_auth: basic_auth) | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Line is too long. [111/80]
| allow(HTTParty).to receive(:get) { StubbedResponse.new } | ||
| end | ||
|
|
||
| it 'allows sending parameters in a request' do |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| describe 'Basic Auth' do | ||
| let(:basic_auth) { {username: 'foo', password: 'bar'} } |
There was a problem hiding this comment.
Space inside { missing.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Space inside } missing.
| end | ||
| end | ||
|
|
||
| describe 'Basic Auth' do |
There was a problem hiding this comment.
Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
Would be nice to have this feature in master. |
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) | ||
| api.users(55).get | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [111/80]
| end | ||
|
|
||
| it 'allows setting parameters globally' do | ||
| api = Blanket::wrap("http://api.example.org", basic_auth: basic_auth) |
There was a problem hiding this comment.
Style/ColonMethodCall: Do not use :: for method calls.
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) | ||
| end | ||
|
|
||
| it 'allows setting parameters globally' do |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| it 'allows sending parameters in a request' do | ||
| api.users(55).get(basic_auth: basic_auth) | ||
|
|
||
| expect(HTTParty).to have_received(:get).with('http://api.example.org/users/55', basic_auth: basic_auth) |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [111/80]
| allow(HTTParty).to receive(:get) { StubbedResponse.new } | ||
| end | ||
|
|
||
| it 'allows sending parameters in a request' do |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
| end | ||
|
|
||
| describe 'Basic Auth' do | ||
| let(:basic_auth) { {username: 'foo', password: 'bar'} } |
There was a problem hiding this comment.
Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.
| end | ||
| end | ||
|
|
||
| describe 'Basic Auth' do |
There was a problem hiding this comment.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
|
Why has this never made it to master? Is there any more up to date gem? |
Complete with spec and Readme updates :)