Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove qs from fetch-api #438

Merged
merged 2 commits into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hungry-bulldogs-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@giphy/js-fetch-api': minor
---

remove qs library, use URLSearchParams
4 changes: 1 addition & 3 deletions packages/fetch-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 7 additions & 2 deletions packages/fetch-api/src/api.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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()
}

/**
Expand Down
6 changes: 2 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
Loading