mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00

In case a stream the request is being piped into closes, we don't want to close the request since it shares a socket with the response.
15 lines
432 B
TypeScript
15 lines
432 B
TypeScript
import type { IncomingMessage } from 'http';
|
|
import type { Guarded } from '../util/GuardedStream';
|
|
|
|
/**
|
|
* An incoming HTTP request;
|
|
*/
|
|
export type HttpRequest = Guarded<IncomingMessage>;
|
|
|
|
/**
|
|
* Checks if the given stream is an HttpRequest.
|
|
*/
|
|
export function isHttpRequest(stream: any): stream is HttpRequest {
|
|
return typeof stream.socket === 'object' && typeof stream.url === 'string' && typeof stream.method === 'string';
|
|
}
|