-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add test for credentrial detection in protocol agnistic url
- Loading branch information
1 parent
2cba1bc
commit 069a070
Showing
2 changed files
with
10 additions
and
14 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 |
---|---|---|
|
@@ -23,6 +23,15 @@ describe('Spec compliance', () => { | |
), | ||
); | ||
}); | ||
it('rejects on protocol agnostic url containing credentials', async () => { | ||
await expect( | ||
fetchMock.fetchHandler('//user:[email protected]'), | ||
).rejects.toThrow( | ||
new TypeError( | ||
'Request cannot be constructed from a URL that includes credentials: //user:[email protected]/', | ||
), | ||
); | ||
}); | ||
it('reject if the request method is GET or HEAD and the body is non-null.', async () => { | ||
await expect( | ||
fetchMock.fetchHandler('http://a.com', { body: 'a' }), | ||
|