{"_id":"@blued-core-oversea/http-client-no-qconf","name":"@blued-core-oversea/http-client-no-qconf","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"@blued-core-oversea/http-client-no-qconf","version":"0.1.0","description":"<!--  * @Date: 2024-11-29 15:59:22  * @LastEditors: kiddy fanzhenzhen@blued.com  * @LastEditTime: 2024-11-29 19:10:52  * @FilePath: /http-client/README.md  * @Description:  --> 基于 request 的一层封装。","main":"dist/index.js","scripts":{"test":"mocha -r ts-node/register test/**/*.spec.ts --exit","build":"rm -rf dist && tsc","watch":"tsc -w","start":"NODE_ENV=test node dist","start-pro":"NODE_ENV=local node dist","prepare":"npm run build","fix":"cd ./node_modules/node-qconf/build/Release/ && install_name_tool -change libqconf.dylib /usr/local/qconf/lib/libqconf.dylib ./qconf.node"},"keywords":[],"author":"","license":"ISC","dependencies":{"@blued-core/cache":"^1.0.6","@blued-core/client":"^0.1.0","@blued-core/conf-intl":"^0.1.1","@blued-core/qconf":"^2.0.2","agentkeepalive":"^4.1.3","axios":"^0.20.0"},"devDependencies":{"@commitlint/cli":"^7.5.2","@commitlint/config-conventional":"^7.5.0","@types/chai":"^4.1.7","@types/mocha":"^5.2.7","@types/node":"^11.13.5","@typescript-eslint/eslint-plugin":"^1.6.0","chai":"^4.2.0","commitizen":"^3.0.7","eslint":"^5.16.0","eslint-config-blued-typescript":"^1.0.1","eslint-plugin-import":"2.17.3","mocha":"^6.1.4","ts-node":"^8.1.0","typescript":"^3.4.3"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"publishConfig":{"access":"public"},"_id":"@blued-core-oversea/http-client-no-qconf@0.1.0","_nodeVersion":"12.22.3","_npmVersion":"6.14.13","dist":{"integrity":"sha512-xEsCKgECfg+yhMvmN7VJSyL5HuDnLUHy9q9RewGG/V29HEKzLNBa62CEqWk08xRmE9+EhI5bz2PIzY0O0nbYdw==","shasum":"58029bd9becec9227ebaef7bb3adfe2b3ed99d17","tarball":"https://registry.npmjs.org/@blued-core-oversea/http-client-no-qconf/-/http-client-no-qconf-0.1.0.tgz","fileCount":17,"unpackedSize":26802,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCDy+EVg00uhM51uKuFqBOpevrPooyLRyQHqZFbJiBTwwIhAJCBuZniKAE0rk9Ch78ofDnOxRvf/XHLEthoD42DkYl9"}]},"_npmUser":{"name":"bluediapp","email":"iappdeveloper@blued.com"},"directories":{},"maintainers":[{"name":"bluediapp","email":"iappdeveloper@blued.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/http-client-no-qconf_0.1.0_1732880675824_0.5133977756635109"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-29T11:44:35.718Z","0.1.0":"2024-11-29T11:44:35.999Z","modified":"2024-11-29T11:44:36.315Z"},"maintainers":[{"name":"bluediapp","email":"iappdeveloper@blued.com"}],"description":"<!--  * @Date: 2024-11-29 15:59:22  * @LastEditors: kiddy fanzhenzhen@blued.com  * @LastEditTime: 2024-11-29 19:10:52  * @FilePath: /http-client/README.md  * @Description:  --> 基于 request 的一层封装。","keywords":[],"license":"ISC","readme":"<!--\n * @Date: 2024-11-29 15:59:22\n * @LastEditors: kiddy fanzhenzhen@blued.com\n * @LastEditTime: 2024-11-29 19:10:52\n * @FilePath: /http-client/README.md\n * @Description: \n-->\n基于 request 的一层封装。\n\n```bash\nnpm i @blued-core/http-client\n```\n\n> cache 与 qconf-conf 组件都为可选的，可以自己根据描述自定义\n\n使用方式：\n\n```typescript\nimport HttpClient from '@blued-core/http-client'\nimport Cache from '@blued-core/cache'\nimport { Qconf } from '@blued-core/qconf'\n\nconst qconfConf = new QconfHost({\n  host1: 'XXX'\n})\n\n// Cache 可以使用 Map 代替\nconst httpClient = new HttpClient(qconfConf, new Cache())\n\nconst httpClient1 = httpClient.getClient('host1')\n\nasync function main () {\n  const res = await httpClient1.getData({\n    url: 'path1/path2',\n    qs: { id: 1 }\n  })\n\n  console.log(res)\n}\n\nmain()\n```\n\n### API\n\n调用参数与`request`参数一致，提供如下八个方法：\n\n基于`method`抽出来的四个方法：`get`、`post`、`put`、`delete`。  \n基于以上四个方法的基础上处理返回值的四个方法：`getData`、`postData`、`putData`、`deleteData`。  \n\n#### 两者的区别\n\n```typescript\nhttpClient.get({\n  url: 'XXX'\n}) // => { code: 200, data: 'Hello World' }\n\nhttpClient.getData({\n  url: 'XXX'\n}) // => 'Hello World'\n```","readmeFilename":"README.md"}