0.1.6 • Published 7 months ago

@blued-core-oversea/http-client v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
7 months ago

基于 undici 的一层封装。

npm i @blued-core-oversea/http-client

http request client:

const httpClient = new RequestClient({
  test: {
    maxConnections: 100,
    isQconf: true,
    qconfHost: '/xxxxxx/xxxx/xxx',
  },
})

// or
const httpClient = new RequestClient({
  test: '/xxxxxx/xxxx/xxx', // qconf 地址
})

const testClient = () => httpClient.getClient('test')

async function main () {
  const res = await testClient().get({
    url: 'test/v1',
    headersTimeout: 100,
  })

  console.log(res)
}

main()

支持的 API 列表

1. get(config: Config): Promise<any>
2. post(config: Config): Promise<any>
3. put(config: Config): Promise<any>
4. delete(config: Config): Promise<any>
5. getData(config: Config): Promise<any>
6. postData(config: Config): Promise<any>
7. putData(config: Config): Promise<any>
8. deleteData(config: Config): Promise<any>
9. getString(config: Config): Promise<string>
10. postString(config: Config): Promise<string>
11. putString(config: Config): Promise<string>
12. deleteString(config: Config): Promise<string>
13. do(config: Config, method: undici.Dispatcher.HttpMethod): Promise<undici.Dispatcher.ResponseData>
14. doWithoutStatusCodeException(config: Config, method: undici.Dispatcher.HttpMethod): Promise<undici.Dispatcher.ResponseData>
0.1.2

8 months ago

0.1.1

8 months ago

0.1.4

7 months ago

0.1.3

7 months ago

0.1.6

7 months ago

0.1.5

7 months ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago