2.0.6 • Published 9 months ago

@ngify/http-uni v2.0.6

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

@ngify/http-uni

version Node.js CI License CodeFactor

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

安装

npm install @ngify/http-uni

API

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

基本用法

import { withUni } from '@ngify/http-uni';

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

额外参数

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

import { UNI_UPLOAD_FILE_TOKEN, UNI_DOWNLOAD_FILE_TOKEN, UNI_REQUSET_TOKEN } from '@ngify/http-uni';

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

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

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

9 months ago

2.0.5

9 months ago

2.0.4

12 months ago

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

0.0.0

1 year ago