Open
Description
Description
After upgrading from 9.0.0 to the latest version the objects injected by decorators to controllers are undefined.
import { Response } from 'koa';
import 'reflect-metadata';
import { Get, JsonController, Res } from 'routing-controllers';
import { autoInjectable } from 'tsyringe';
import { Controller } from '../interface';
import { StatusCodes } from 'http-status-codes';
@JsonController('/example')
@autoInjectable()
export class ExampleController implements Controller {
constructor() {
}
@Get()
async process(@Res() response: Response) {
console.log('inside controller'); // this is logged ✅
console.log(response); // this is undefined ❌
response.status = StatusCodes.OK
response.body = { some: 'response' }
return response;
}
}
Expected behavior
Should return the response object
Actual behavior
{
"name": "TypeError",
"message": "Cannot set properties of undefined (setting 'status')",
"stack": "TypeError: Cannot set properties of undefined (setting 'status')\n.....
}