From 2342c0b42b72e730d758467a460194b1ef588044 Mon Sep 17 00:00:00 2001 From: Diana Bergey Date: Thu, 6 Mar 2025 14:26:51 -0500 Subject: [PATCH] Allow TryIt to send request body for GET and DELETE requests #2230 --- packages/elements-core/src/components/TryIt/build-request.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/elements-core/src/components/TryIt/build-request.ts b/packages/elements-core/src/components/TryIt/build-request.ts index 84ce2dd39..ab9e3fd28 100644 --- a/packages/elements-core/src/components/TryIt/build-request.ts +++ b/packages/elements-core/src/components/TryIt/build-request.ts @@ -147,7 +147,7 @@ export async function buildFetchRequest({ const serverUrl = getServerUrl({ httpOperation, mockData, chosenServer, corsProxy, serverVariableValues }); const shouldIncludeBody = - ['PUT', 'POST', 'PATCH'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined; + ['GET', 'PUT', 'POST', 'PATCH', 'DELETE'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined; const queryParams = getQueryParams({ httpOperation, parameterValues }); @@ -264,7 +264,7 @@ export async function buildHarRequest({ const mimeType = mediaTypeContent?.mediaType ?? 'application/json'; const shouldIncludeBody = - ['PUT', 'POST', 'PATCH'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined; + ['GET','PUT', 'POST', 'PATCH', 'DELETE'].includes(httpOperation.method.toUpperCase()) && bodyInput !== undefined; const queryParams = getQueryParams({ httpOperation, parameterValues });