update
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { SmartRequest, SmartResponse, type ICoreRequestOptions } from '../core/index.js';
|
||||
import { CoreRequest, CoreResponse, type ICoreRequestOptions } from '../core/index.js';
|
||||
import * as plugins from '../core/plugins.js';
|
||||
|
||||
import type { HttpMethod, ResponseType, FormField } from './types/common.js';
|
||||
@@ -223,35 +223,35 @@ export class SmartRequestClient<T = any> {
|
||||
/**
|
||||
* Make a GET request
|
||||
*/
|
||||
async get<R = T>(): Promise<SmartResponse<R>> {
|
||||
async get<R = T>(): Promise<CoreResponse<R>> {
|
||||
return this.execute<R>('GET');
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a POST request
|
||||
*/
|
||||
async post<R = T>(): Promise<SmartResponse<R>> {
|
||||
async post<R = T>(): Promise<CoreResponse<R>> {
|
||||
return this.execute<R>('POST');
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a PUT request
|
||||
*/
|
||||
async put<R = T>(): Promise<SmartResponse<R>> {
|
||||
async put<R = T>(): Promise<CoreResponse<R>> {
|
||||
return this.execute<R>('PUT');
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a DELETE request
|
||||
*/
|
||||
async delete<R = T>(): Promise<SmartResponse<R>> {
|
||||
async delete<R = T>(): Promise<CoreResponse<R>> {
|
||||
return this.execute<R>('DELETE');
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a PATCH request
|
||||
*/
|
||||
async patch<R = T>(): Promise<SmartResponse<R>> {
|
||||
async patch<R = T>(): Promise<CoreResponse<R>> {
|
||||
return this.execute<R>('PATCH');
|
||||
}
|
||||
|
||||
@@ -296,7 +296,7 @@ export class SmartRequestClient<T = any> {
|
||||
/**
|
||||
* Execute the HTTP request
|
||||
*/
|
||||
private async execute<R = T>(method?: HttpMethod): Promise<SmartResponse<R>> {
|
||||
private async execute<R = T>(method?: HttpMethod): Promise<CoreResponse<R>> {
|
||||
if (method) {
|
||||
this._options.method = method;
|
||||
}
|
||||
@@ -308,8 +308,8 @@ export class SmartRequestClient<T = any> {
|
||||
|
||||
for (let attempt = 0; attempt <= this._retries; attempt++) {
|
||||
try {
|
||||
const response = await SmartRequest.create(this._url, this._options);
|
||||
return response as SmartResponse<R>;
|
||||
const response = await CoreRequest.create(this._url, this._options);
|
||||
return response as CoreResponse<R>;
|
||||
} catch (error) {
|
||||
lastError = error as Error;
|
||||
|
||||
|
Reference in New Issue
Block a user