@advanced-rest-client/arc-headers

中文文档
0.1.16发布于 2022/09/10Apache-2.0ESM + CJS近 30 天下载 3343

A module that contains UI and logic for handle HTTP headers in an HTTP request and request editors.

原始使用文档
文档目录8 节
  1. Usage
  2. Installation
  3. HeadersParser module
  4. HeadersEditorElement
  5. HeadersListElement
  6. Development
  7. Running the demo locally
  8. Running the tests

Deprecated

This component is deprecated. Use @advanced-rest-client/app instead.


A module that contains UI and logic for handle HTTP headers in an HTTP request and request editors.

Published on NPM

Tests and publishing

Usage

Installation

npm install --save @advanced-rest-client/arc-headers

HeadersParser module

A helper class to process headers as string, array, object, or a Headers object.

import { HeadersParser } from '@advanced-rest-client/arc-headers';
const errorMessage = HeadersParser.getError('Whitespace Name: x-true');

HeadersEditorElement

An HTTP headers editor UI.

<headers-editor id="editor"></headers-editor>
<script>
{
  editor.model = [{ name: 'content-type', value: 'application/json', enabled: true }];
  // or
  editor.value = 'content-type: application/json';
  editor.onchange = (e) => { console.log(e.target.value, e.target.model); }
}
</script>

Try not to use both value and model when setting the value of the editor. The last set value wins and overrides the other one. If your application uses the headers view model (to add support for enable/disable header state) then only use model. The editor will produce value when anything after setting up the model change. This is done to minimize number of computations when working with the editor.

The component listens to content type change event (defined in arc-events as RequestEvents.State.contentTypeChange) and updated the current value when the event is handled.

HeadersListElement

An list of formatted HTTP headers.

<headers-list id="list"></headers-list>
<script>
{
  editor.headers = 'content-type: x-test\nLink: <https://api.github.com/organizations/19393150/repos?page=6>, rel="next";';
}
</script>

Development

git clone https://github.com/advanced-rest-client/arc-headers
cd arc-headers
npm install

Running the demo locally

npm start

Running the tests

npm test

版本与发布记录

@advanced-rest-client/arc-headers 共发布 18 个版本,首次发布于 2020/10/04;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.1.16latest2022/09/104 年前
0.1.152022/05/064 年前
0.1.142021/12/224 年前
0.1.132021/11/164 年前
0.1.122021/11/114 年前
0.1.112021/10/205 年前

关于 @advanced-rest-client/arc-headers 的常见问题

@advanced-rest-client/arc-headers 是什么?

A module that contains UI and logic for handle HTTP headers in an HTTP request and request editors.

如何安装 @advanced-rest-client/arc-headers?

在项目目录运行 npm install @advanced-rest-client/arc-headers,或使用 pnpm add / yarn add / bun add。

@advanced-rest-client/arc-headers 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/advanced-rest-client__arc-headers 是否存在。

@advanced-rest-client/arc-headers 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@advanced-rest-client/arc-headers 可以商用吗?

@advanced-rest-client/arc-headers 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@advanced-rest-client/arc-headers 的下载量有多少?

根据 npm 官方下载统计,@advanced-rest-client/arc-headers 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,343 次,日均约 111 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@advanced-rest-client/arc-headers 还在维护吗?

最新版本 0.1.16 发布于 2022/09/10(4 年前);至今共发布 18 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/10/04。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。