@advanced-rest-client/arc-cookies

中文文档
0.2.1发布于 2021/10/21Apache-2.0ESM + CJS近 30 天下载 3058

A module that contains all UI and logic that adds support for cookie manipulation in Advanced REST Client

原始使用文档
文档目录8 节
  1. Usage
  2. Installation
  3. Cookie parser
  4. Manipulating cookies
  5. Cookie screen
  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 the logic and the UIs for handle cookies and sessions in Advanced REST Client.

Published on NPM

tests

Usage

Installation

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

It parses set-cookie header received from the server and produces a Cookie object.

import { Cookies } from '@advanced-rest-client/cookie-parser';

const parser = new Cookies('rememberme=1; domain=foo.com; path=/; ssid=Hy1t5e#oj21.876aak;', 'http://bar.com/');
console.log(parser.cookies);

which is equivalent to:

const cookies = Cookies.parse('...');

The second argument is the request URL needed to properly pase cookies.

Manipulating cookies

The filter function filters out cookies that should not be considered for given URL. This is defined in https://tools.ietf.org/html/rfc6265.

const instance = new Cookies('a=b; domain=foo.com; path=/;', 'http://sub.foo.com/');
const removed = instance.filter();
console.log(removed); // has the cookies because domain does not match

To clear expired cookies just call clearExpired() function.

const instance = new Cookies('a=b; expires=0;', 'http://sub.foo.com/');
// wait a second here, then
const removed = instance.filter();
console.log(removed); // the cookie expired

The cookie-manager renders the cookies screen in Advanced REST Client. It uses events defined in @advanced-rest-client/arc-events to request and to communicate the state.

<cookie-manager listType="default"></cookie-manager>

Development

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

Running the demo locally

npm start

Running the tests

npm test

版本与发布记录

@advanced-rest-client/arc-cookies 共发布 4 个版本,首次发布于 2020/12/13;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.2.1latest2021/10/215 年前
0.2.02021/06/015 年前
0.1.12021/02/145 年前
0.1.02020/12/135 年前

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

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

A module that contains all UI and logic that adds support for cookie manipulation in Advanced REST Client

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

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

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

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

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

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

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

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

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

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

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

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