Skip to content

Commit

Permalink
Merge pull request #438 from Giphy/remove-qs-package
Browse files Browse the repository at this point in the history
remove qs from fetch-api
  • Loading branch information
giannif authored Feb 22, 2024
2 parents 9cbbf87 + 3b5e333 commit 3d61e3e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
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

0 comments on commit 3d61e3e

Please sign in to comment.