-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
1 changed file
with
5 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import {IRequest, IRequestStrict} from './Router' | ||
import { IRequest, IRequestStrict } from './Router' | ||
|
||
export type HasContent<ContentType> = { | ||
content: ContentType, | ||
} & IRequestStrict | ||
|
||
// withContent - embeds any request body as request.content | ||
export const withContent = async (request: IRequest): Promise<void> => { | ||
if (request.headers.get('content-type')?.includes('json')) | ||
request.content = await request.json() | ||
} | ||
|
||
export type HasContent<ContentType> = { | ||
content: ContentType, | ||
} & IRequestStrict |