# Function: request
▸ request(params
: RequestParams): Promise‹RequestRes› & RequestTask
发起 HTTPS 网络请求
description
使用前请注意阅读:
# 参数:
属性 | 类型 |
---|---|
params | RequestParams |
RequestParams
属性 | 类型 | 描述 |
---|---|---|
data? | string | Record‹string, any› | ArrayBuffer | 请求的参数 |
dataType? | "json" | string | 返回的数据格式 |
enableCache? | boolean | 开启 cache |
enableHttp2? | boolean | 开启 http2 |
enableQuic? | boolean | 开启 quic |
header? | Record‹string, any› | 设置请求的 header |
method? | "OPTIONS" | "GET" | "HEAD" | "POST" | "PUT" | "DELETE" | "TRACE" | "CONNECT" | HTTP 请求方法 |
responseType? | "text" | "arraybuffer" | 响应的数据类型 |
timeout? | number | 超时时间 |
url | string | 开发者服务器接口地址 |
complete? | Method | 接口调用结束的回调函数(调用成功、失败都会执行) |
fail? | Method | 接口调用失败的回调函数 |
success? | Method | 接口调用成功的回调函数 |
# 返回值:
Promise‹RequestRes› & RequestTask