网络请求工具类,可以实现比较常见的一些请求操作。
function get(url: string, options?: RequestOptions): Promise<Response>
url 地址
请求的配置参数,结构为
interface RequestOptions {
method?: string;
accept?: string;
contentType?: string;
customerHeaders?: { [key: string]: string };
signal?: AbortSignal | null;
progress?: (this: XMLHttpRequestUpload, ev: ProgressEvent<XMLHttpRequestEventTarget>) => any
}
请求类型,默认为 GET 或 POST
Accept 请求头的值
Content-Type 请求头的值