From f12ed391ab42c52fc5ba5db7dbdca08fb3562109 Mon Sep 17 00:00:00 2001 From: Gianni Ferullo Date: Thu, 22 Feb 2024 17:14:47 -0500 Subject: [PATCH] remove qs from fetch-api use URLSearchParams --- packages/fetch-api/package.json | 4 +--- packages/fetch-api/src/api.ts | 9 +++++++-- yarn.lock | 6 ++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/packages/fetch-api/package.json b/packages/fetch-api/package.json index ed5e83a3..75d54611 100644 --- a/packages/fetch-api/package.json +++ b/packages/fetch-api/package.json @@ -36,11 +36,9 @@ }, "dependencies": { "@giphy/js-types": "*", - "@giphy/js-util": "*", - "qs": "^6.9.4" + "@giphy/js-util": "*" }, "devDependencies": { - "@types/qs": "^6.9.4", "jest-fetch-mock": "^3.0.3", "parcel-bundler": "latest", "typedoc": "^0.20.37", diff --git a/packages/fetch-api/src/api.ts b/packages/fetch-api/src/api.ts index 199ce952..8267c33e 100644 --- a/packages/fetch-api/src/api.ts +++ b/packages/fetch-api/src/api.ts @@ -1,7 +1,6 @@ /* eslint-disable no-dupe-class-members */ import { GifID } from '@giphy/js-types' import { getPingbackId } from '@giphy/js-util' -import qs from 'qs' import { normalizeGif, normalizeGifs } from './normalize/gif' import { CategoriesOptions, @@ -42,7 +41,13 @@ export class GiphyFetch { * @hidden */ private getQS = (options: any = {}) => { - return qs.stringify({ ...options, api_key: this.apiKey, pingback_id: getPingbackId(), ...this.qsParams }) + const searchParams = new URLSearchParams({ + ...options, + api_key: this.apiKey, + pingback_id: getPingbackId(), + ...this.qsParams, + }) + return searchParams.toString() } /** diff --git a/yarn.lock b/yarn.lock index 48414c0d..dd758ae5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2529,10 +2529,8 @@ __metadata: dependencies: "@giphy/js-types": "*" "@giphy/js-util": "*" - "@types/qs": ^6.9.4 jest-fetch-mock: ^3.0.3 parcel-bundler: latest - qs: ^6.9.4 typedoc: ^0.20.37 typedoc-thunder-theme: ^0.0.3 typescript: ^5.0.4 @@ -5507,7 +5505,7 @@ __metadata: languageName: node linkType: hard -"@types/qs@npm:*, @types/qs@npm:^6.9.4, @types/qs@npm:^6.9.5": +"@types/qs@npm:*, @types/qs@npm:^6.9.5": version: 6.9.7 resolution: "@types/qs@npm:6.9.7" checksum: 7fd6f9c25053e9b5bb6bc9f9f76c1d89e6c04f7707a7ba0e44cc01f17ef5284adb82f230f542c2d5557d69407c9a40f0f3515e8319afd14e1e16b5543ac6cdba @@ -18158,7 +18156,7 @@ __metadata: languageName: node linkType: hard -"qs@npm:^6.10.0, qs@npm:^6.11.0, qs@npm:^6.11.1, qs@npm:^6.6.0, qs@npm:^6.9.4": +"qs@npm:^6.10.0, qs@npm:^6.11.0, qs@npm:^6.11.1, qs@npm:^6.6.0": version: 6.11.2 resolution: "qs@npm:6.11.2" dependencies: