core
    正在准备搜索索引...

    接口 RequestData

    网络请求

    interface RequestData {
        data?: any;
        dataType?: string;
        dnsOverHttps?: string;
        dnsServers?: string[];
        enableCache?: boolean;
        enableChunked?: boolean;
        enableHttp2?: boolean;
        enableQuic?: boolean;
        firstIpv4?: boolean;
        forceCellularNetwork?: boolean;
        header?: Record<string, string>;
        method?:
            | "OPTIONS"
            | "GET"
            | "HEAD"
            | "POST"
            | "PUT"
            | "DELETE"
            | "TRACE"
            | "CONNECT";
        responseType?: "text"
        | "arraybuffer";
        sslVerify?: boolean;
        timeout?: number;
        url: string;
        withCredentials?: boolean;
    }
    索引

    属性

    data?: any

    请求的参数

    dataType?: string

    返回的数据格式。值为 json 时,返回的数据为 JSON,返回后会对返回的数据进行一次 JSON.parse;其他值则不对返回的内容进行 JSON.parse

    dnsOverHttps?: string

    设置使用 HTTPS 协议的服务器进行 DNS 解析。

    • 参数必须根据以下格式进行URL编码:"https:// host:port/path"。
    dnsServers?: string[]

    设置指定的 DNS 服务器进行 DNS 解析。

    • 最多可以设置3个DNS解析服务器。如果有3个以上,只取前3个。
    • 服务器必须是IPV4或者IPV6地址。
    enableCache?: boolean

    开启 cache

    enableChunked?: boolean

    开启 transfer-encoding chunked

    enableHttp2?: boolean

    开启 http2

    enableQuic?: boolean

    开启 quic

    firstIpv4?: boolean

    DNS解析时优先使用 ipv4

    forceCellularNetwork?: boolean

    wifi下使用移动网络发送请求

    header?: Record<string, string>

    设置请求的 header,header 中不能设置 Referer。content-type 默认为 application/json

    method?:
        | "OPTIONS"
        | "GET"
        | "HEAD"
        | "POST"
        | "PUT"
        | "DELETE"
        | "TRACE"
        | "CONNECT"

    方法,可选值 OPTIONS,GET,HEAD,POST,PUT,DELETE,TRACE,CONNECT

    GET
    
    responseType?: "text" | "arraybuffer"

    设置响应的数据类型。合法值:text、arraybuffer

    sslVerify?: boolean

    验证 ssl 证书

    timeout?: number

    超时时间

    url: string

    资源 url

    withCredentials?: boolean

    跨域请求时是否携带凭证