-
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.
Accept URL encoded form data instead of JSON
- Loading branch information
1 parent
409ded8
commit 2d5181f
Showing
2 changed files
with
17 additions
and
12 deletions.
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
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 |
---|---|---|
|
@@ -80,7 +80,7 @@ describe(PATH, () => { | |
const headers = new Headers({ Origin: site.origin }) | ||
|
||
describe.each([ | ||
'application/x-www-form-urlencoded', | ||
'application/json', | ||
'multipart/form-data', | ||
'text/html', | ||
'text/plain', | ||
|
@@ -119,10 +119,10 @@ describe(PATH, () => { | |
) | ||
}) | ||
|
||
describe('when Content-Type header is application/json', () => { | ||
headers.set('Content-Type', 'application/json') | ||
describe('when Content-Type header is application/x-www-form-urlencoded', () => { | ||
headers.set('Content-Type', 'application/x-www-form-urlencoded') | ||
|
||
describe('when a valid json body is not provided', () => { | ||
describe('when a body is not provided', () => { | ||
const request = new Request(ROUTE, { headers, method }) | ||
const consoleError = console.error | ||
|
||
|
@@ -195,7 +195,7 @@ describe(PATH, () => { | |
}) | ||
|
||
describe('when all required fields are valid', () => { | ||
const body = JSON.stringify({ | ||
const body = new URLSearchParams({ | ||
email: '[email protected]', | ||
message: 'This is an example message.', | ||
name: 'Example', | ||
|