chore: type cast a couple of cases which should never happen

This commit is contained in:
WebStreamr 2026-01-12 19:55:23 +00:00
parent eaadc91c2d
commit 33b3f130c1
No known key found for this signature in database
4 changed files with 4 additions and 4 deletions

View file

@ -22,7 +22,7 @@ export class ConfigureController {
}
private getConfigure(req: Request, res: Response) {
const config: Config = JSON.parse(req.params['config'] || JSON.stringify(getDefaultConfig()));
const config: Config = JSON.parse(req.params['config'] as string || JSON.stringify(getDefaultConfig()));
// Convenience preset for ElfHosted WebStreamr bundle including Media Flow Proxy
if (!req.params['config'] && isElfHostedInstance(req)) {

View file

@ -21,7 +21,7 @@ export class ManifestController {
}
private getManifest(req: Request, res: Response) {
const config: Config = JSON.parse(req.params['config'] || JSON.stringify(getDefaultConfig()));
const config: Config = JSON.parse(req.params['config'] as string || JSON.stringify(getDefaultConfig()));
const manifest = buildManifest(this.sources, this.extractors, config);

View file

@ -27,7 +27,7 @@ export class StreamController {
private async getStream(req: Request, res: Response) {
const type: ContentType = (req.params['type'] || '') as ContentType;
const rawId: string = req.params['id'] || '';
const rawId: string = req.params['id'] as string || '';
let id: Id;
if (rawId.startsWith('tmdb:')) {

View file

@ -7,6 +7,6 @@ export const contextFromRequestAndResponse = (req: Request, res: Response): Cont
hostUrl: new URL(`${req.protocol}://${req.host}`),
id: res.getHeader('X-Request-ID') as string,
...(req.ip && { ip: req.ip }),
config: req.params['config'] ? JSON.parse(req.params['config']) : getDefaultConfig(),
config: req.params['config'] ? JSON.parse(req.params['config'] as string) : getDefaultConfig(),
};
};