New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

rest-api-kit

Package Overview
Dependencies
Maintainers
0
Versions
52
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rest-api-kit - npm Package Compare versions

Comparing version 0.0.42 to 0.0.43

2

dist/index.d.ts

@@ -39,3 +39,3 @@ type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";

headers: HeadersInit;
bodyAsQueryParams: boolean;
bodyAsParams: boolean;
}

@@ -42,0 +42,0 @@ interface StoreHookReturnType<R, T> {

@@ -99,6 +99,14 @@ "use strict";

if (url.includes("/:")) {
const queryParams = [];
for (const [key, value] of Object.entries(body)) {
const regex = new RegExp(`/:${key}`, "g");
url = url.replace(regex, `/${value}`);
if (regex.test(url)) {
url = url.replace(regex, `/${value}`);
} else {
queryParams.push(`${key}=${value}`);
}
}
if (queryParams.length > 0) {
url += `?${queryParams.join("&")}`;
}
return url;

@@ -320,3 +328,3 @@ }

url = getBaseUrl(url, options?.baseUrl);
const formattedUrl = params.method === "GET" || params.bodyAsQueryParams ? concatenateParamsWithUrl(url, body) : !!body && !!urlParams ? concatenateParamsWithUrl(url, urlParams) : url;
const formattedUrl = params.method === "GET" || params.bodyAsParams ? concatenateParamsWithUrl(url, body) : !!body && !!urlParams ? concatenateParamsWithUrl(url, urlParams) : url;
load(dispatch, formattedUrl, { ...params, headers }, body);

@@ -350,3 +358,3 @@ let storeIdentifier = `${options.baseUrl || ""}&${params.endpointName}`;

url: formattedUrl,
body: params.bodyAsQueryParams ? {} : body,
body: params.bodyAsParams ? {} : body,
method: params.method

@@ -407,3 +415,3 @@ },

successCondition: () => true,
bodyAsQueryParams: false,
bodyAsParams: false,
headers: {}

@@ -410,0 +418,0 @@ };

{
"name": "rest-api-kit",
"version": "0.0.42",
"version": "0.0.43",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "module": "dist/index.mjs",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc