From 0641f5004430d6e0a9a931ab0a1fbc61d7c4ed88 Mon Sep 17 00:00:00 2001 From: Patrick McElhaney Date: Thu, 16 Jan 2025 18:10:45 -0500 Subject: [PATCH] type fix: header should be headers (#1160) --- docs/usage.md | 4 ++-- src/server/types.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usage.md b/docs/usage.md index 3a29bd706..e1b47e441 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -121,11 +121,11 @@ return $.response[200].header("x-coolness-level", 10).text("This is cool!")`. ### Request parameters -Most of the time, the server's response depends on input from various parts of the request, which are accessible through `$.path`, `$.query`, `$.header`, and `$.body`. The best way to explain is with an example: +Most of the time, the server's response depends on input from various parts of the request, which are accessible through `$.path`, `$.query`, `$.headers`, and `$.body`. The best way to explain is with an example: ```ts export const GET: HTTP_GET = ($) => { - if ($.header['x-token'] !== 'super-secret') { + if ($.headers['x-token'] !== 'super-secret') { return $.response[401].text('unauthorized'); } diff --git a/src/server/types.ts b/src/server/types.ts index 066ec3442..203968804 100644 --- a/src/server/types.ts +++ b/src/server/types.ts @@ -259,7 +259,7 @@ interface WideResponseBuilder { interface WideOperationArgument { body: unknown; context: unknown; - header: { [key: string]: string }; + headers: { [key: string]: string }; path: { [key: string]: string }; proxy: (url: string) => { proxyUrl: string }; query: { [key: string]: string };