# @cypress/debugging-proxy 中文文档

规范地址：https://npmcn.com/package/%40cypress/debugging-proxy/

版本：2\.0\.1
npm 元数据更新时间：2022-04-05T02:27:21.344Z
中文译文更新时间：2026-11-11T07:16:34.788Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40cypress/debugging-proxy
原文对照：https://npmcn.com/package/%40cypress/debugging-proxy/?lang=original
项目主页：https://github.com/cypress-io/node-debugging-proxy
源码仓库：https://github.com/cypress-io/node-debugging-proxy

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：706 kB，8 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：3 个
- 首次发布：2019-04-01T21:35:11.213Z
- 最新版本发布：2019-05-06T21:32:38.177Z
- 近 30 天下载量：193588（2026-10-11 至 2026-11-09，npm 官方下载统计）
- 已发布版本数：3（近 12 个月 0 个）

## 中文简介

节点- 调试- 代理qq

## 安装

```sh
npm install @cypress/debugging-proxy
```

也可以使用：`pnpm add @cypress/debugging-proxy`、`yarn add @cypress/debugging-proxy`、`bun add @cypress/debugging-proxy`

## README

# 节点调试- 代理

[![NPM](https://nodei.co/npm/@cypress/debugging-proxy.svg?downloads=true)](https://npmjs.org/package/@cypress/debugging-proxy)

一个简单的 HTTP 代理, 代表 HTTP 和 HTTP 透明地请求 。 用于调试您的应用程序与代理正确工作 .

## 安装

```
npm i -g @cypress/debugging-proxy

## or, if you prefer yarn
yarn global add @cypress/debugging-proxy
```

## 用法( 作为独立的服务器)

### 在端口1337启动代理

```
debugging-proxy
```

### 使用自定义端口

```
PORT=1234 debugging-proxy
```

### 显示所有请求的日志

```
DEBUG=proxy debugging-proxy
```

### 代理访问需要 HTTP 基本 Auth

```
PROXY_USER=some-username PROXY_PASS=some-password debugging-proxy
```

### 使用自定义密钥和证书复制 HTTPS 代理

```
HTTPS_KEY=/path/to/key.key HTTPS_CERT=/path/to/cert.pem debugging-proxy
```

## 用法(作为一个模块,在测试中)

```js
const debugProxy = require('@cypress/debugging-proxy')

// create an instance
const proxy = new debugProxy({
    auth: { // if `auth` is set, HTTP basic authentication to the proxy will be required using these credentials
        username: 'foo',
        password: 'bar'
    },
    keepRequests: false, // if `keepRequests` is set, the proxy will store a log of requests that can be retrieved using `proxy.getRequests()`
    https: { // if https is set, https.createServer will be called with this key and cert to launch the server
        key: fs.readFileSync('my-key.pem'),
        cert: fs.readFileSync('my-cert.pem')
    }
})

// using your stubbing/spying library of choice...
spy(proxy.proxyRequestToUrl)
spy(proxy.proxySslConnectionToDomain)

// start an httpproxy on localhost:3000
proxy.start(3000).then(() => {
    // make some requests using the proxy at localhost:3000, then...
    expect(proxy.proxyRequestToUrl).to.be.calledWith('http://google.com')
    expect(proxy.proxySslConnectionToDomain).to.be.calledWith('google.com')

    expect(proxy.getRequests().find(incomingMessage => incomingMessage.ssl === false)).to.exist

    // clean up
    proxy.stop().then(() => {
        console.log('All done!')
    })
})
```

## 常见问题

### @cypress/debugging-proxy 是什么？

节点- 调试- 代理qq

### 如何安装 @cypress/debugging-proxy？

在项目目录运行 npm install @cypress/debugging-proxy，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 debugging-proxy，可以用 npx debugging-proxy 直接运行。

### @cypress/debugging-proxy 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/cypress\_\_debugging-proxy 是否存在。

### @cypress/debugging-proxy 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @cypress/debugging-proxy 可以商用吗？

@cypress/debugging-proxy 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @cypress/debugging-proxy 的下载量有多少？

根据 npm 官方下载统计，@cypress/debugging-proxy 在 2026/10/11 – 2026/11/09 这 30 天内被下载 193,588 次，日均约 6,453 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @cypress/debugging-proxy 还在维护吗？

最新版本 2\.0\.1 发布于 2019/05/07（7 年前）；至今共发布 3 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/04/02。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

