{"action":"created","issue":{"url":"https://api.github.com/repos/nestjs/nest/issues/1004","repository_url":"https://api.github.com/repos/nestjs/nest","labels_url":"https://api.github.com/repos/nestjs/nest/issues/1004/labels{/name}","comments_url":"https://api.github.com/repos/nestjs/nest/issues/1004/comments","events_url":"https://api.github.com/repos/nestjs/nest/issues/1004/events","html_url":"https://github.com/nestjs/nest/issues/1004","id":353735011,"node_id":"MDU6SXNzdWUzNTM3MzUwMTE=","number":1004,"title":"Response mapping. Duplicate nesting level.","user":{"login":"ph55","id":1386622,"node_id":"MDQ6VXNlcjEzODY2MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/1386622?v=4","gravatar_id":"","url":"https://api.github.com/users/ph55","html_url":"https://github.com/ph55","followers_url":"https://api.github.com/users/ph55/followers","following_url":"https://api.github.com/users/ph55/following{/other_user}","gists_url":"https://api.github.com/users/ph55/gists{/gist_id}","starred_url":"https://api.github.com/users/ph55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph55/subscriptions","organizations_url":"https://api.github.com/users/ph55/orgs","repos_url":"https://api.github.com/users/ph55/repos","events_url":"https://api.github.com/users/ph55/events{/privacy}","received_events_url":"https://api.github.com/users/ph55/received_events","type":"User","site_admin":false},"labels":[{"id":1026289724,"node_id":"MDU6TGFiZWwxMDI2Mjg5NzI0","url":"https://api.github.com/repos/nestjs/nest/labels/needs%20clarification","name":"needs clarification","color":"d6f25c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-08-24T10:46:59Z","updated_at":"2018-08-24T11:11:00Z","closed_at":null,"author_association":"NONE","body":"Response map from official doc return duplicate nesting level.\r\nhttps://docs.nestjs.com/interceptors\r\n```ts\r\nimport { Injectable, NestInterceptor, ExecutionContext } from '@nestjs/common';\r\nimport { Observable } from 'rxjs';\r\nimport { map } from 'rxjs/operators';\r\n\r\nexport interface Response<T> {\r\n  data: T;\r\n}\r\n\r\n@Injectable()\r\nexport class TransformInterceptor<T>\r\n  implements NestInterceptor<T, Response<T>> {\r\n  intercept(\r\n    context: ExecutionContext,\r\n    call$: Observable<T>,\r\n  ): Observable<Response<T>> {\r\n    return call$.pipe(map(data => ({ data })));\r\n  }\r\n}\r\n```\r\n\r\nResponse for\r\n```ts\r\n@Get()\r\nasync test(): Promise<any> {\r\n  return 'ok';\r\n}\r\n```\r\nis:\r\n\r\n```ts\r\n{\r\n  data: {\r\n    data: \"ok\"\r\n  }\r\n}\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nestjs/nest/issues/comments/415728363","html_url":"https://github.com/nestjs/nest/issues/1004#issuecomment-415728363","issue_url":"https://api.github.com/repos/nestjs/nest/issues/1004","id":415728363,"node_id":"MDEyOklzc3VlQ29tbWVudDQxNTcyODM2Mw==","user":{"login":"ph55","id":1386622,"node_id":"MDQ6VXNlcjEzODY2MjI=","avatar_url":"https://avatars2.githubusercontent.com/u/1386622?v=4","gravatar_id":"","url":"https://api.github.com/users/ph55","html_url":"https://github.com/ph55","followers_url":"https://api.github.com/users/ph55/followers","following_url":"https://api.github.com/users/ph55/following{/other_user}","gists_url":"https://api.github.com/users/ph55/gists{/gist_id}","starred_url":"https://api.github.com/users/ph55/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ph55/subscriptions","organizations_url":"https://api.github.com/users/ph55/orgs","repos_url":"https://api.github.com/users/ph55/repos","events_url":"https://api.github.com/users/ph55/events{/privacy}","received_events_url":"https://api.github.com/users/ph55/received_events","type":"User","site_admin":false},"created_at":"2018-08-24T11:11:00Z","updated_at":"2018-08-24T11:11:00Z","author_association":"NONE","body":"So I've tested in controller with `@UseInterceptors(new ResponseInterceptor())` works well.\r\n\r\n**But** when used in module with provider I get duplicate nesting, hmm...\r\n```ts\r\n{\r\n  provide: APP_INTERCEPTOR,\r\n  useClass: ResponseInterceptor\r\n}\r\n```"}}
{"actor":{"display_login":"ph55"}}