light-my-request
Advanced tools
Comparing version 4.7.0 to 4.7.1
@@ -23,3 +23,3 @@ import * as stream from 'stream' | ||
type DispatchFunc = (req: Request, res: Response) => void | ||
type DispatchFunc = (req: Request, res: ServerResponse) => void | ||
@@ -30,3 +30,3 @@ type CallbackFunc = (err: Error, response: Response) => void | ||
function isInjection (obj: Request | Response): boolean | ||
function isInjection (obj: Request | ServerResponse): boolean | ||
@@ -76,3 +76,5 @@ interface InjectOptions { | ||
interface Response extends http.ServerResponse { | ||
interface ServerResponse extends http.ServerResponse {} | ||
interface Response { | ||
raw: { | ||
@@ -79,0 +81,0 @@ res: http.ServerResponse, |
{ | ||
"name": "light-my-request", | ||
"version": "4.7.0", | ||
"version": "4.7.1", | ||
"description": "Fake HTTP injection library", | ||
@@ -14,3 +14,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/node": "^16.0.0", | ||
"@types/node": "^17.0.0", | ||
"benchmark": "^2.1.4", | ||
@@ -17,0 +17,0 @@ "end-of-stream": "^1.4.4", |
import * as http from 'http' | ||
import { inject, isInjection, Request, Response, DispatchFunc, InjectOptions, Chain } from '../index' | ||
import { expectType, expectAssignable } from 'tsd' | ||
import { inject, isInjection, Request, Response, DispatchFunc, InjectOptions, Chain, ServerResponse } from '../index' | ||
import { expectType, expectAssignable, expectNotAssignable } from 'tsd' | ||
expectAssignable<InjectOptions>({ url: '/' }) | ||
const dispatch = function (req: Request, res: Response) { | ||
const dispatch = function (req: Request, res: ServerResponse) { | ||
expectType<boolean>(isInjection(req)) | ||
@@ -20,3 +20,3 @@ expectType<boolean>(isInjection(res)) | ||
expectAssignable<Function>(res.json) | ||
expectAssignable<http.ServerResponse>(res.raw.res) | ||
expectAssignable<ServerResponse>(res.raw.res) | ||
expectAssignable<Request>(res.raw.req) | ||
@@ -92,1 +92,3 @@ console.log(res.cookies) | ||
expectType<ParsedValue>(parsedValueUsingGeneric) | ||
expectNotAssignable<http.ServerResponse>(response) |
Sorry, the diff of this file is not supported yet
83604
2312