Skip to content

Commit

Permalink
feat: add default type values
Browse files Browse the repository at this point in the history
  • Loading branch information
César Alberca committed Jan 3, 2022
1 parent 0f60fc2 commit 9ffcb96
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/utils/src/http-client/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,23 @@ export class HttpClient {
return this.sendRequest(url, { method: 'GET' }, httpParams)
}

async post<Result, Body>(url: string, body: Body, httpParams?: HttpParams): Promise<HttpClientResponse<Result>> {
async post<Body, Result = void>(
url: string,
body: Body,
httpParams?: HttpParams
): Promise<HttpClientResponse<Result>> {
return this.sendRequest(url, { method: 'POST', body: this.getParsedBody(body) }, httpParams)
}

async put<Result, Body>(url: string, body: Body, httpParams?: HttpParams): Promise<HttpClientResponse<Result>> {
async put<Body, Result = void>(
url: string,
body: Body,
httpParams?: HttpParams
): Promise<HttpClientResponse<Result>> {
return this.sendRequest(url, { method: 'PUT', body: this.getParsedBody(body) }, httpParams)
}

async delete<Result>(url: string, httpParams?: HttpParams): Promise<HttpClientResponse<Result>> {
async delete<Result = void>(url: string, httpParams?: HttpParams): Promise<HttpClientResponse<Result>> {
return this.sendRequest(url, { method: 'DELETE' }, httpParams)
}

Expand Down

0 comments on commit 9ffcb96

Please sign in to comment.