@nestjs/common
Version:
Decorators, pipes, exceptions and utilities for NestJS applications: @Controller(), @Injectable(), @Body(), ValidationPipe, HttpException and more.
12 lines (11 loc) • 525 B
JavaScript
import { isFunction, isObject } from './shared.utils.js';
/**
* Whether the router streams this value instead of serializing it: a web
* `Response`, or an async iterable that is not also a thenable. `@nestjs/core`
* has its own copy, as it may run against an older `@nestjs/common`.
*/
export function isStreamingBody(value) {
return (isObject(value) &&
((isFunction(value[Symbol.asyncIterator]) && !isFunction(value['then'])) ||
Object.prototype.toString.call(value) === '[object Response]'));
}