From 04e9c7ec84c63d2a5cdd6ddd8ce1c31e17595adf Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Thu, 9 Nov 2023 11:54:31 +0100 Subject: [PATCH] fix: no request body on GET requests (#5) --- package.json | 2 +- src/Reflect.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 87bd638..77e656c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "reflect-client", - "version": "1.1.0", + "version": "1.1.1", "main": "build/Reflect.js", "type": "module", "exports": { diff --git a/src/Reflect.ts b/src/Reflect.ts index 868fab3..86bab18 100644 --- a/src/Reflect.ts +++ b/src/Reflect.ts @@ -38,8 +38,8 @@ export default class Client { headers: this.headers } - // JSON stringify and append body to request if provided - if (payload) { + // JSON stringify and append body to request if provided and is not a GET request + if (payload && method !== Method.GET) { options["body"] = JSON.stringify(payload); }