refactor: delegando os parametros padrão para o executarRequest
This commit is contained in:
parent
436b5c5b7f
commit
2d32904a40
1 changed files with 2 additions and 5 deletions
|
@ -146,6 +146,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
data,
|
||||
params,
|
||||
contentType = ContentType.APPLICATION_JSON,
|
||||
...opt
|
||||
}: ExecutarRequestParams): Promise<ResponseType> {
|
||||
try {
|
||||
await this.getAccessToken();
|
||||
|
@ -163,6 +164,7 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
headers,
|
||||
data,
|
||||
params,
|
||||
...opt,
|
||||
});
|
||||
|
||||
return response.data;
|
||||
|
@ -183,7 +185,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
async get<ResponseType>(opt: ExecutarRequestParams) {
|
||||
return this.executarRequest<ResponseType>({
|
||||
method: "GET",
|
||||
contentType: opt.contentType || ContentType.APPLICATION_JSON,
|
||||
...opt,
|
||||
});
|
||||
}
|
||||
|
@ -191,7 +192,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
async put<ResponseType>(opt: ExecutarRequestParams) {
|
||||
return this.executarRequest<ResponseType>({
|
||||
method: "PUT",
|
||||
contentType: opt.contentType || ContentType.APPLICATION_JSON,
|
||||
...opt,
|
||||
});
|
||||
}
|
||||
|
@ -199,7 +199,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
async patch<ResponseType>(opt: ExecutarRequestParams) {
|
||||
return this.executarRequest<ResponseType>({
|
||||
method: "PATCH",
|
||||
contentType: opt.contentType || ContentType.APPLICATION_JSON,
|
||||
...opt,
|
||||
});
|
||||
}
|
||||
|
@ -207,7 +206,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
async post<ResponseType>(opt: ExecutarRequestParams) {
|
||||
return this.executarRequest<ResponseType>({
|
||||
method: "POST",
|
||||
contentType: opt.contentType || ContentType.APPLICATION_JSON,
|
||||
...opt,
|
||||
});
|
||||
}
|
||||
|
@ -215,7 +213,6 @@ export class LhispOauthClient<iAccessToken extends AccessToken = AccessToken> {
|
|||
async delete<ResponseType>(opt: ExecutarRequestParams) {
|
||||
return this.executarRequest<ResponseType>({
|
||||
method: "DELETE",
|
||||
contentType: opt.contentType || ContentType.APPLICATION_JSON,
|
||||
...opt,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue