Skip to content

Commit

Permalink
Expose the response headers
Browse files Browse the repository at this point in the history
In order to access headers in a browser, we need to expose them as per
CORS protocol.

Fix the spec name
  • Loading branch information
volkanunsal committed Sep 25, 2014
1 parent da24dde commit 1566df5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
bundler_args: --without assets:development:production
language: ruby
rvm:
- 2.1.1
- 2.1.2
addons:
postgresql: "9.3"
before_script:
Expand Down
2 changes: 1 addition & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Application < Rails::Application
config.middleware.use Rack::Cors do
allow do
origins '*'
resource %r{/locations|organizations|search/*}, headers: :any, methods: [:get, :put, :patch, :post, :delete]
resource %r{/locations|organizations|search/*}, headers: :any, methods: [:get, :put, :patch, :post, :delete], expose: ['Link', 'X-Total-Count']
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/api/cors_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
end

it 'returns an empty Access-Control-Expose-Headers header' do
expect(headers['Access-Control-Expose-Headers']).to eq('')
expect(headers['Access-Control-Expose-Headers']).to eq('Link, X-Total-Count')
end

it 'allows access to the locations endpoint' do
Expand Down Expand Up @@ -127,8 +127,8 @@
expect(headers['Access-Control-Allow-Credentials']).to eq('true')
end

it 'returns an empty Access-Control-Expose-Headers header' do
expect(headers['Access-Control-Expose-Headers']).to eq('')
it 'exposes the Link and X-Total-Count headers' do
expect(headers['Access-Control-Expose-Headers']).to eq('Link, X-Total-Count')
end
end

Expand Down

0 comments on commit 1566df5

Please sign in to comment.