Skip to content

Commit

Permalink
test inclusion of response headers
Browse files Browse the repository at this point in the history
  • Loading branch information
vlewin committed Jun 12, 2014
1 parent 173ed03 commit 3df836d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion spec/connect/connection_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@
end

end

end

describe '#post' do
Expand Down Expand Up @@ -192,6 +191,19 @@
result.code.should eq 200
end

it 'response includes API response headers' do
api_version = SUSE::Connect::Api::VERSION

stub_request(:post, 'https://example.com/api/v1/test')
.with(:body => '', :headers => { 'Authorization' => 'Token token=zulu' })
.to_return(:status => 200, :body => '{}', :headers => { 'scc-api-version' => api_version })

connection = subject.new('https://example.com')
result = connection.post('/api/v1/test', :auth => 'Token token=zulu')
result.headers['scc-api-version'].first.should eq api_version
result.code.should eq 200
end

it 'send params alongside with request' do

stub_request(:post, 'https://example.com/api/v1/test')
Expand Down

0 comments on commit 3df836d

Please sign in to comment.