Skip to content

Commit

Permalink
refactor(got): hTTP requests now use qs to generate query strings
Browse files Browse the repository at this point in the history
  • Loading branch information
Luke Carr committed May 21, 2020
1 parent de32873 commit f78ce13
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
11 changes: 11 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@semantic-release/git": "^9.0.0",
"@types/jest": "^25.2.3",
"@types/node": "^14.0.4",
"@types/qs": "^6.9.3",
"@typescript-eslint/eslint-plugin": "^2.34.0",
"@typescript-eslint/parser": "^2.34.0",
"codecov": "^3.7.0",
Expand All @@ -80,7 +81,8 @@
},
"dependencies": {
"@babel/runtime": "^7.9.6",
"got": "^11.1.4"
"got": "^11.1.4",
"qs": "^6.9.4"
},
"config": {
"commitizen": {
Expand Down
7 changes: 4 additions & 3 deletions src/modules/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import qs from "qs";
import { Client } from "../client";
import FunctionResponse from "../functions/response";

Expand Down Expand Up @@ -38,10 +39,10 @@ export default abstract class Module {
searchParams?: any
): Promise<FunctionResponse> {
const response = await this.client.got.get("webservice/rest/server.php", {
searchParams: {
searchParams: qs.stringify({
wsfunction,
...searchParams,
},
...searchParams
}),
responseType: "json",
});

Expand Down

0 comments on commit f78ce13

Please sign in to comment.