mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
fix(server/video-view): log invalid currentTime req (#6288)
* fix(server/video-view): log invalid currentTime req relates to #6285 * Styling --------- Co-authored-by: Chocobozzz <me@florianbigard.com>
This commit is contained in:
parent
855def80f6
commit
26de1467e2
3 changed files with 14 additions and 11 deletions
|
@ -1,11 +1,11 @@
|
|||
import { HttpStatusCode } from '@peertube/peertube-models'
|
||||
import { logger } from '@server/helpers/logger.js'
|
||||
import express from 'express'
|
||||
import { ProblemDocument, ProblemDocumentExtension } from 'http-problem-details'
|
||||
import { logger } from '@server/helpers/logger.js'
|
||||
import { HttpStatusCode } from '@peertube/peertube-models'
|
||||
|
||||
function apiFailMiddleware (req: express.Request, res: express.Response, next: express.NextFunction) {
|
||||
res.fail = options => {
|
||||
const { status = HttpStatusCode.BAD_REQUEST_400, message, title, type, data, instance, tags } = options
|
||||
const { status = HttpStatusCode.BAD_REQUEST_400, message, title, type, data, instance, tags, logLevel = 'debug' } = options
|
||||
|
||||
const extension = new ProblemDocumentExtension({
|
||||
...data,
|
||||
|
@ -29,7 +29,7 @@ function apiFailMiddleware (req: express.Request, res: express.Response, next: e
|
|||
: undefined
|
||||
}, extension)
|
||||
|
||||
logger.debug('Bad HTTP request.', { json, tags })
|
||||
logger.log(logLevel, 'Bad HTTP request.', { json, tags })
|
||||
|
||||
res.status(status)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue