Skip to content

Commit

Permalink
use lower-case headers: cf. rack/rack#1592
Browse files Browse the repository at this point in the history
  • Loading branch information
keyasuda committed Jan 27, 2024
1 parent 31dfe6b commit 9236dd9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gem/spec/bormashino/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class MockApp < Sinatra::Base

it 'sends referer' do
expect(subject.first).to eq 302
expect(subject[1]['Location']).to eq 'http://example.com:0/referer'
expect(subject[1]['location']).to eq 'http://example.com:0/referer'
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions npm/src/applyServerResult.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ export const applyServerResult = (src, target, router) => {
return true

case 302:
const loc = new URL(src[1]['Location'])
const loc = new URL(src[1]['location'])

if (loc.host == 'example.com:0') {
const path = loc.pathname + loc.search
router.pushState(path)
} else {
location.href = src[1]['Location']
location.href = src[1]['location']
}
return false

Expand Down
6 changes: 3 additions & 3 deletions npm/src/applyServerResult.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('applyServerResult', () => {

describe('302 relative location', () => {
beforeEach(() => {
content = [302, { Location: 'http://example.com:0/location' }, []]
content = [302, { location: 'http://example.com:0/location' }, []]
ret = applyServerResult(content, target, router)
})

Expand All @@ -132,13 +132,13 @@ describe('applyServerResult', () => {
delete window.location
window.location = { assign: jest.fn() }

content = [302, { Location: 'http://absolute.example.com/location' }, []]
content = [302, { location: 'http://absolute.example.com/location' }, []]

ret = applyServerResult(content, target, router)
})

it('navigates to the location', () => {
expect(location.href).toEqual(content[1]['Location'])
expect(location.href).toEqual(content[1]['location'])
})

it('returns true', () => {
Expand Down

0 comments on commit 9236dd9

Please sign in to comment.