ngify
    Preparing search index...

    Module @ngify/http-taro

    @ngify/http-taro

    version Node.js CI License CodeFactor

    @ngify/http 的 Taro HTTP 请求适配器。

    npm install @ngify/http-taro
    

    有关完整的 API 定义,请访问 https://ngify.github.io/ngify.

    import { withTaro } from '@ngify/http-taro';

    const http = new HttpClient(
    withTaro()
    );
    // or
    setupHttpClient(
    withTaro()
    );

    Taro 请求还支持更多额外的参数,使用 HttpContext 来传递它们:

    import { TARO_UPLOAD_FILE_TOKEN, TARO_DOWNLOAD_FILE_TOKEN, TARO_REQUSET_TOKEN } from '@ngify/http-taro';

    // 开启 HTTP2
    http.get('/api', {
    context: new HttpContext().set(TARO_REQUSET_TOKEN, {
    enableHttp2: true,
    })
    });

    // 文件上传
    http.post('url', null, {
    context: new HttpContext().set(TARO_UPLOAD_FILE_TOKEN, {
    filePath: 'filePath',
    fileName: 'fileName'
    })
    });

    // 文件下载
    http.get('/api', {
    context: new HttpContext().set(TARO_DOWNLOAD_FILE_TOKEN, {
    filePath: 'filePath'
    })
    });

    Classes

    HttpTaroBackend

    Variables

    TARO_DOWNLOAD_FILE_TOKEN
    TARO_REQUSET_TOKEN
    TARO_UPLOAD_FILE_TOKEN

    Functions

    withTaro