From 6ca88b6712f48c77a48099eb824598245b784b15 Mon Sep 17 00:00:00 2001 From: Aitor Alonso Date: Thu, 11 Nov 2021 22:26:59 +0100 Subject: [PATCH] Relax `send()` method typing (#63) * refacto: relaxes send method typing. Closes #62 * chore: updates contributors and bumps version --- package-lock.json | 2 +- package.json | 6 ++++-- src/TepperBuilder.ts | 8 ++++---- src/TepperConfig.ts | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 6afa2831..58475d51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "tepper", - "version": "0.3.3", + "version": "0.3.4", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 34870962..85ed0d6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tepper", - "version": "0.3.3", + "version": "0.3.4", "description": "Modern library for testing HTTP servers", "main": "dist/tepper.js", "engines": { @@ -8,8 +8,10 @@ }, "homepage": "https://github.com/DanielRamosAcosta/tepper", "repository": "https://github.com/DanielRamosAcosta/tepper", + "author": "Daniel Ramos ", "contributors": [ - "Daniel Ramos " + "Daniel Ramos ", + "Aitor Alonso " ], "license": "MIT", "scripts": { diff --git a/src/TepperBuilder.ts b/src/TepperBuilder.ts index 50e20f81..38a1b645 100644 --- a/src/TepperBuilder.ts +++ b/src/TepperBuilder.ts @@ -1,9 +1,9 @@ +import { ParsedUrlQueryInput } from "querystring" +import { BaseUrlServerOrExpress } from "./BaseUrlServerOrExpress" +import { DebugOptions } from "./DebugOptions" import { TepperConfig } from "./TepperConfig" import { TepperResult } from "./TepperResult" import { TepperRunner } from "./TepperRunner" -import { BaseUrlServerOrExpress } from "./BaseUrlServerOrExpress" -import { ParsedUrlQueryInput } from "querystring" -import { DebugOptions } from "./DebugOptions" export class TepperBuilder { public constructor( private readonly baseUrlServerOrExpress: BaseUrlServerOrExpress, @@ -50,7 +50,7 @@ export class TepperBuilder { }) } - public send(body: Record | Array) { + public send(body: string | object) { return new TepperBuilder(this.baseUrlServerOrExpress, { ...this.config, body, diff --git a/src/TepperConfig.ts b/src/TepperConfig.ts index d5ba52f5..e9ff6f9c 100644 --- a/src/TepperConfig.ts +++ b/src/TepperConfig.ts @@ -4,7 +4,7 @@ import { DebugOptions } from "./DebugOptions" export type TepperConfig = { readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" readonly path: string - readonly body: Record | Array | null + readonly body: string | object | null readonly query: ParsedUrlQueryInput | null readonly redirects: number readonly expectedStatus: number | null