Skip to content

Commit

Permalink
Use null instead of undefined for node fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Apr 12, 2018
1 parent 3059d8e commit fdfee11
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions source/platforms/github/GitHubAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -385,16 +385,11 @@ export class GitHubAPI {
)
}

get = (path: string, headers: any = {}, body: any = undefined): Promise<node_fetch.Response> =>
this.api(path, headers, body, "GET")
get = (path: string, headers: any = {}): Promise<node_fetch.Response> => this.api(path, headers, null, "GET")

post = (path: string, headers: any = {}, body: any = {}, suppressErrors?: boolean): Promise<node_fetch.Response> =>
this.api(path, headers, JSON.stringify(body), "POST", suppressErrors)

patch = (
path: string,
headers: any = {},
body: any = undefined,
suppressErrors?: boolean
): Promise<node_fetch.Response> => this.api(path, headers, JSON.stringify(body), "PATCH", suppressErrors)
patch = (path: string, headers: any = {}, body: any = {}, suppressErrors?: boolean): Promise<node_fetch.Response> =>
this.api(path, headers, JSON.stringify(body), "PATCH", suppressErrors)
}

1 comment on commit fdfee11

@azz
Copy link
Member

@azz azz commented on fdfee11 Apr 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this same changes needs to be done for BitBucketServerAPI.ts. On v3.4.7 I'm getting

	Error:  TypeError: Request with GET/HEAD method cannot have body

Please sign in to comment.