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

    接口 RequestData

    网络请求

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

    属性

    data?: any

    请求的参数

    dataType?: string

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

    enableCache?: boolean

    开启 cache

    enableChunked?: boolean

    开启 transfer-encoding chunked

    enableHttp2?: boolean

    开启 http2

    enableHttpDNS?: boolean

    是否开启 HttpDNS 服务。如开启,需要同时填入 httpDNSServiceId 。 HttpDNS 用法详见 移动解析HttpDNS

    enableQuic?: boolean

    开启 quic

    firstIpv4?: boolean

    DNS解析时优先使用 ipv4

    forceCellularNetwork?: boolean

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

    header?: Record<string, string>

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

    httpDNSServiceId?: string

    HttpDNS 服务商 Id。 HttpDNS 用法详见 移动解析HttpDNS

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

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

    GET
    
    responseType?: string

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

    sslVerify?: boolean

    验证 ssl 证书

    timeout?: number

    超时时间

    url: string

    资源 url

    withCredentials?: boolean

    跨域请求时是否携带凭证