# @ecoding/helper.got

> dev request

Latest version **0.2.7** (published 2026-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install @ecoding/helper.got
pnpm add @ecoding/helper.got
yarn add @ecoding/helper.got
bun add @ecoding/helper.got
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.2.7 |
| Published | 2026-03-17 |
| First published | 2023-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 22.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | cxc |
| Maintainers | w3cwhy |

## Links

- npm: https://www.npmjs.com/package/@ecoding/helper.got
- npm.io page: https://npm.io/package/@ecoding/helper.got

## Dependencies (1)

- [got](https://npm.io/package/got.md) ^11.8.6

## Recent versions

- 0.2.7 (latest) — 2026-03-17
- 0.2.6 — 2026-03-06
- 0.2.5 — 2025-12-22
- 0.2.4 — 2025-12-22
- 0.2.3 — 2025-11-07
- 0.2.2 — 2025-11-04
- 0.2.1 — 2025-07-07
- 0.2.0 — 2024-04-10
- 0.1.11 — 2024-01-22
- 0.1.10 — 2024-01-03
- 0.1.9 — 2023-12-06
- 0.1.8 — 2023-11-27
- 0.1.7 — 2023-11-27
- 0.1.6 — 2023-11-27
- 0.1.5 — 2023-10-24
- … 14 more at https://npm.io/package/@ecoding/helper.got/versions

## README

import R from "@ecoding/helper.got";
const r = R.getInstance();
const getHttp = (env) => {
    r.setReqHook(async (options) => {
        // /api/user/ 调用 user 服务
        const url = options.url;
        if (url.indexOf("/api/user/") !== -1) {
            r.setDomain("http://api.sciecomm.cn");
        }
        return Promise.resolve(options);
    });

    // switch (env) {
    //     case EnvEnum.local:
    //     case EnvEnum.test: {
    //         r.setDomain("");
    //     }
    //     default: {
    //         r.setDomain("");
    //     }
    // }

    return r;
}
export default getHttp;

```
agent
import { HttpsProxyAgent } from "https-proxy-agent";
const agent = new HttpsProxyAgent("http://127.0.0.1:1087");
const completion = await r.post("https://api.openai.com/v1/chat/completions", {
        model: "gpt-3.5-turbo",
        messages: [{"role": "user", "content": "Say this is a test!"}],
        temperature: 0.7
    },
    {
        headers: {
            "Authorization": "Bearer {Key}"
        },
        agent: {
            http: agent,
            https: agent,
        }
    }
);
```

---
_Source: https://npm.io/package/@ecoding/helper.got · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
