From 982f8bb3f44a64bfb4a36a4ff48dbe4a18671dfc Mon Sep 17 00:00:00 2001 From: Kyle Dodson Date: Thu, 5 Sep 2024 17:40:59 -0700 Subject: [PATCH] Fix injecting custom request header in beforeRequest hook --- .manifest.json | 4 ++-- src/http/hooks/custom-hook.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.manifest.json b/.manifest.json index 46fff6c..d3c76ad 100644 --- a/.manifest.json +++ b/.manifest.json @@ -1,6 +1,6 @@ { "liblabVersion": "2.1.31", - "date": "2024-09-05T21:54:58.569Z", + "date": "2024-09-06T00:38:54.512Z", "config": { "apiId": 1126, "sdkName": "salad-cloud-imds-sdk", @@ -155,7 +155,7 @@ }, "multiTenant": true, "hooksLocation": { - "bucketKey": "7017/hooks.zip", + "bucketKey": "7019/hooks.zip", "bucketName": "prod-liblab-api-stack-hooks" }, "includeWatermark": false, diff --git a/src/http/hooks/custom-hook.ts b/src/http/hooks/custom-hook.ts index 6c4cb3b..994fcfd 100644 --- a/src/http/hooks/custom-hook.ts +++ b/src/http/hooks/custom-hook.ts @@ -5,10 +5,10 @@ import { HttpRequest, HttpResponse, HttpError } from './hook'; export class CustomHook implements Hook { public async beforeRequest(request: HttpRequest, params: Map): Promise { if (request.headers == null) { - request.headers = {}; + request.headers = new Map(); } - request.headers['Metadata'] = 'true'; + request.headers.set('Metadata', 'true'); return request; }