Skip to content

Commit

Permalink
Change options to optional
Browse files Browse the repository at this point in the history
  • Loading branch information
ryunix committed Sep 17, 2023
1 parent 5579327 commit 8d0c301
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ export class RestAPI {
async request(
method: string,
path: string,
options: {
options?: {
body?: any;
params?: any;
}
): Promise<any> {
let url = this.engine_url + path;
if (options.params) {
if (options?.params) {
url += "?" + new URLSearchParams(options.params).toString();
}
var fetch_options: fetchOptions = {
method: method,
};
if (options.body) {
if (options?.body) {
fetch_options["headers"] = { "Content-Type": "application/json" };
fetch_options["body"] = JSON.stringify(options.body);
}
Expand Down

0 comments on commit 8d0c301

Please sign in to comment.