Skip to content

Commit

Permalink
Use native express types
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelBCarter committed Mar 13, 2024
1 parent 925f28e commit 5e4c2ed
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/middleware/jsonBodyParser/jsonBodyParser.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import bodyParser from 'body-parser'
import type {NextHandleFunction} from 'connect'
import { NextFunction, Request, Response } from 'express'

const bodyParserInstance = bodyParser.json({ type: ['application/json', 'text/json'] })

// If we do not trap this error, then it dumps too much to log, usually happens if request aborted
export const jsonBodyParser: NextHandleFunction = (req, res, next) => {
export const jsonBodyParser = (req: Request, res: Response, next: NextFunction) => {
try {
bodyParserInstance(req, res, next)
} catch (ex) {
Expand Down

0 comments on commit 5e4c2ed

Please sign in to comment.