Skip to content

Commit

Permalink
fix(OctonoRequest): added params to body when not GET request
Browse files Browse the repository at this point in the history
  • Loading branch information
jcrqr committed Sep 11, 2021
1 parent e35afa3 commit 05ca7b3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class OctonoRequest extends Request {
E extends keyof Endpoints,
P extends OctonoRequestInit = E extends keyof Endpoints
? Endpoints[E]["parameters"] & OctonoRequestInit
: OctonoRequestInit
: OctonoRequestInit,
>(endpoint: E, params?: P): OctonoRequest {
const baseURL = params?.baseURL ? params.baseURL : GITHUB_URL;

Expand All @@ -77,6 +77,10 @@ export class OctonoRequest extends Request {
},
};

if (method !== Method.GET) {
init.body = JSON.stringify(params || {});
}

return new OctonoRequest(url.toString(), init);
}
}

0 comments on commit 05ca7b3

Please sign in to comment.