From 4d8e65ead6303d40d87b0c5cc3ac29573e4d7bf8 Mon Sep 17 00:00:00 2001 From: Blake Embrey Date: Wed, 22 May 2019 00:08:48 -0700 Subject: [PATCH] Add default body type to `Common` interfaces --- src/common.ts | 9 ++++----- src/node.ts | 5 +++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/common.ts b/src/common.ts index 53b2e36..1344391 100644 --- a/src/common.ts +++ b/src/common.ts @@ -26,7 +26,7 @@ export type CommonBodyConstructor = { /** * Abstract body shared between node.js and browsers. */ -export interface CommonBody { +export interface CommonBody { $rawBody: T | null | undefined; // Use `undefined` as a mark of "used". headers: Headers; readonly bodyUsed: boolean; @@ -51,10 +51,10 @@ export interface CommonRequestOptions { /** * Request implementation standard. */ -export interface CommonRequest extends CommonBody { +export interface CommonRequest extends CommonBody { + url: string method: string signal: Signal - headers: Headers trailer: Promise } @@ -71,9 +71,8 @@ export interface CommonResponseOptions { /** * Response implementation standard. */ -export interface CommonResponse extends CommonBody { +export interface CommonResponse extends CommonBody { status: number statusText: string - headers: Headers trailer: Promise } diff --git a/src/node.ts b/src/node.ts index 91d084c..56f9e28 100644 --- a/src/node.ts +++ b/src/node.ts @@ -8,7 +8,8 @@ import { EmptyBody, CommonRequestOptions, CommonResponseOptions, - CommonRequest + CommonRequest, + CommonResponse } from "./common"; export type RawBody = Readable | Buffer | string; @@ -217,7 +218,7 @@ export class Request extends Body implements CommonRequest { /** * Node.js `Response` implementation. */ -export class Response extends Body { +export class Response extends Body implements CommonResponse { status: number; statusText: string; trailer: Promise;