forked from sveltejs/kit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ignore 'content-type' header capitalization (sveltejs#1463)
Fixes sveltejs#1463
- Loading branch information
1 parent
1bb44ca
commit b58d04e
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
packages/kit/src/runtime/server/parse_body/parse_body.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { test } from 'uvu'; | ||
import * as assert from 'uvu/assert'; | ||
import { parse_body } from './index.js'; | ||
|
||
test('parses a body with a lowercase content-type', () => { | ||
const msg = { | ||
rawBody: JSON.stringify('the body'), | ||
headers: { 'content-type': 'application/json' } | ||
}; | ||
assert.equal(parse_body(msg), 'the body'); | ||
}); | ||
|
||
test('parses a body with a non-lowercase content-type', () => { | ||
const msg = { | ||
rawBody: JSON.stringify('the body'), | ||
headers: { 'Content-Type': 'application/json' } | ||
}; | ||
assert.equal(parse_body(msg), 'the body'); | ||
}); | ||
|
||
test.run(); |