-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #336 from samchon/features/validate
- Loading branch information
Showing
82 changed files
with
2,021 additions
and
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type express from "express"; | ||
import type { FastifyRequest } from "fastify"; | ||
import raw from "raw-body"; | ||
|
||
export const get_text_body = async ( | ||
request: express.Request | FastifyRequest, | ||
): Promise<string> => | ||
isExpressRequest(request) | ||
? (await raw(request)).toString("utf8") | ||
: (request.body as string); | ||
|
||
const isExpressRequest = ( | ||
request: express.Request | FastifyRequest, | ||
): request is express.Request => (request as express.Request).app !== undefined; |
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,12 @@ | ||
import { BadRequestException, ExecutionContext } from "@nestjs/common"; | ||
import type express from "express"; | ||
import type { FastifyReply } from "fastify"; | ||
|
||
export const send_bad_request = | ||
(context: ExecutionContext) => | ||
(error: BadRequestException): void => { | ||
const response: express.Response | FastifyReply = context | ||
.switchToHttp() | ||
.getResponse(); | ||
response.status(error.getStatus()).send(error.getResponse()); | ||
}; |
Oops, something went wrong.