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

serverless-h3

Package Overview
Dependencies
Maintainers
0
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

serverless-h3 - npm Package Compare versions

Comparing version 1.0.19 to 1.0.20

18

dist/index.js

@@ -15,13 +15,19 @@ "use strict";

function buildUrlWithQueryParams(baseUrl, queryParams) {
const url = new URL(baseUrl);
for (const [key, values] of Object.entries(queryParams)) {
const queryString = Object.entries(queryParams)
.map(([key, values]) => {
// Check if values is an array, otherwise treat it as a single value
if (Array.isArray(values)) {
values.forEach(value => url.searchParams.append(key, value));
return values.map(value => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&');
}
}
return url.toString();
else {
return `${encodeURIComponent(key)}=${encodeURIComponent(values)}`;
}
})
.join('&');
// Append the query string to the base URL
return queryString ? `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}${queryString}` : baseUrl;
}
function serverless(app) {
return (event) => __awaiter(this, void 0, void 0, function* () {
event.path = buildUrlWithQueryParams(event.path, event.queryStringParameters);
event.path = buildUrlWithQueryParams(event.path, event.multiValueQueryStringParameters);
const handler = (0, h3_1.toPlainHandler)(app);

@@ -28,0 +34,0 @@ const response = yield handler(Object.assign(Object.assign({}, event), { method: event.httpMethod }));

{
"name": "serverless-h3",
"version": "1.0.19",
"version": "1.0.20",
"description": "A serverless wrapper for h3 applications",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

// src/index.ts
import { toPlainHandler } from "h3";
function buildUrlWithQueryParams(baseUrl: string, queryParams: any) {
const url = new URL(baseUrl);
for (const [key, values] of Object.entries(queryParams)) {
if (Array.isArray(values)) {
values.forEach(value => url.searchParams.append(key, value));
}
}
return url.toString();
function buildUrlWithQueryParams(baseUrl: string, queryParams: Record<string, string | string[]>) {
const queryString = Object.entries(queryParams)
.map(([key, values]) => {
// Check if values is an array, otherwise treat it as a single value
if (Array.isArray(values)) {
return values.map(value => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`).join('&');
} else {
return `${encodeURIComponent(key)}=${encodeURIComponent(values)}`;
}
})
.join('&');
// Append the query string to the base URL
return queryString ? `${baseUrl}${baseUrl.includes('?') ? '&' : '?'}${queryString}` : baseUrl;
}

@@ -16,3 +22,3 @@

return async (event: any) => {
event.path = buildUrlWithQueryParams(event.path, event.queryStringParameters)
event.path = buildUrlWithQueryParams(event.path, event.multiValueQueryStringParameters)
const handler = toPlainHandler(app);

@@ -19,0 +25,0 @@ const response = await handler({

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