-
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.
- Loading branch information
Showing
15 changed files
with
119 additions
and
46 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
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
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
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
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
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 |
---|---|---|
@@ -1,31 +1,21 @@ | ||
import { NextRequest } from 'next/server' | ||
|
||
export default class RequestExamples { | ||
static basic(path: string = '/', options: { method?: string } = {}) { | ||
const RequestExamples = { | ||
basic: (path: string = '/', options: { method?: string } = {}) => { | ||
return new NextRequest(new URL(`http://internal${path}`), options) | ||
} | ||
}, | ||
|
||
static internalAuthorized() { | ||
return new NextRequest(new URL('http://internal'), { | ||
headers: { | ||
authorization: 'Bearer AUTH_SECRET', | ||
'x-forwarded-for': '::1', | ||
}, | ||
method: 'POST', | ||
}) | ||
} | ||
|
||
static externalAuthorized() { | ||
externalAuthorized: () => { | ||
return new NextRequest(new URL('http://internal'), { | ||
headers: { | ||
authorization: 'Bearer AUTH_SECRET', | ||
'x-forwarded-for': '192.168.1.1', | ||
}, | ||
method: 'POST', | ||
}) | ||
} | ||
}, | ||
|
||
static firewallRequest() { | ||
firewallRequest: () => { | ||
return { | ||
headers: new Headers({ | ||
authorization: 'Bearer AUTH_SECRET', | ||
|
@@ -34,5 +24,17 @@ export default class RequestExamples { | |
json: jest.fn().mockResolvedValue({ email: '[email protected]' }), | ||
method: 'POST', | ||
} as unknown as NextRequest | ||
} | ||
}, | ||
|
||
internalAuthorized: () => { | ||
return new NextRequest(new URL('http://internal'), { | ||
headers: { | ||
authorization: 'Bearer AUTH_SECRET', | ||
'x-forwarded-for': '::1', | ||
}, | ||
method: 'POST', | ||
}) | ||
}, | ||
} | ||
|
||
export default RequestExamples |
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
Oops, something went wrong.