@ewsjs/xhr

中文文档
3.1.3发布于 2024/05/13MITTypeScriptCommonJS近 30 天下载 24.2万

用于ewsjs的其他 XHR 方法

中文使用文档
文档目录14 节
  1. 3.1.2 国家
  2. 3.1.1 国家
  3. 3.1.0 (中文(简体) )
  4. 3.0.0 (单位:千美元)
  5. 2.0.0 (韩语)
  6. 1.5.0 (中文(简体) )
  7. 构造器
  8. 代理服务器支持
  9. 添加 Ntlm 认证( 或使用 EWS 的 Windows 集成认证)
  10. 添加 cookie 认证( 使用 TMG/ ISA)
  11. 使用带有 cookie 认证的代理
  12. 信息: Ntlm 没有代理支持( yet !)
  13. 许可证
  14. 1.1.1 变动

@ewsjs/xhr (英语)

将 ews- javascript- api- auth 更名为 @ ewsjs/ xhr

其他相关的 libs 也将移动到 @ewsjs scope/org

1.3.0带来多处变化,新api和代理支持. 这也是使用流行的重写 request 软件包

3.1.2 国家

  • Axios 的固定代理问题

3.1.1 国家

  • 固定响应

3.1.0 (中文(简体) )

  • 更新依赖关系

3.0.0 (单位:千美元)

  • 更新 @ewsjs/ntlm-client 改为 3.0.0 以 ntlm 修正节点 18+ 问题

2.0.0 (韩语)

  • 删除已贬值的 xhr apis (cookieAuthXhrApi, (中文(简体) ), ntlmAuthXhrApi, (中文(简体) ), proxySupportedXhrApi) (中文(简体) ).
  • 删除对 request, (中文(简体) ), bluebird 财务报告和审定财务报表 fetch。 。 。 .

1.5.0 (中文(简体) )

#15 在流中使用预调选项

安装

npm install @ewsjs/xhr --save

怎么样

公共方法 useProxy, (中文(简体) ), useNtlmAuthentication 财务报告和审定财务报表 useCookieAuthentication 返回链条示例.

// import 
import { ......,  ConfigurationApi } from "ews-javascript-api";
import { XhrApi } from "@ewsjs/xhr";

// create instance
let xhr = new XhrApi({ headers: { 'custom-header': 'value' }, rejectUnauthorized: false})
    .useCookieAuthentication(credentials.userName, credentials.password)
    .useProxy("http://squidorOtherProxyServer:3128", "proxyUser", "password");

// alternatively 
let xhr = new XhrApi({ headers: { 'custom-header': 'value' }, rejectUnauthorized: false});
xhr.useCookieAuthentication(credentials.userName, credentials.password);
xhr.useProxy("http://squidorOtherProxyServer:3128", "proxyUser", "password");

// use in ews-javascript-api
ConfigurationApi.ConfigureXHR(xhr);

构造器

/**
 * Creates an instance of XhrApi optionally passing options for request
 * @memberof XhrApi
 */
new XhrApi();
/**
 * Creates an instance of XhrApi optionally passing options for request
 * @param {CoreOptions} requestOptions Options for request
 * @memberof XhrApi
 */
new XhrApi(requestOptions: CoreOptions); // CoreOptions is from @types/request, part of request pkg
/**
 * Creates an instance of XhrApi. optionally pass true to bypass remote ssl/tls certificate check
 * @param {boolean} allowUntrustedCertificate whether to allow non trusted certificate or not
 * @memberof XhrApi
 */
new XhrApi(allowUntrustedCertificate: boolean);

代理服务器支持

import { XhrApi } from "@ewsjs/xhr";

// without proxy credential
let xhr = new XhrApi({ headers: { 'custom-header': 'value' }, rejectUnauthorized: false})
    .useProxy("http://squidorOtherProxyServer:3128");

// with proxy credential
let xhr = new XhrApi({ headers: { 'custom-header': 'value' }, rejectUnauthorized: false})
    .useProxy("http://squidorOtherProxyServer:3128", "proxyUser", "password");

添加 Ntlm 认证( 或使用 EWS 的 Windows 集成认证)

import { XhrApi } from "@ewsjs/xhr";
let xhr = new XhrApi()
    .useNtlmAuthentication(credentials.userName, credentials.password);

添加 cookie 认证( 使用 TMG/ ISA)

import { XhrApi } from "@ewsjs/xhr";
let xhr = new XhrApi({ rejectUnauthorized: false})
    .useCookieAuthentication(credentials.userName, credentials.password);

使用带有 cookie 认证的代理

import { XhrApi } from "@ewsjs/xhr";
let xhr = new XhrApi(true)
    .useCookieAuthentication(credentials.userName, credentials.password)
    .useProxy("http://squidorOtherProxyServer:3128", "proxyUser", "password");

信息: Ntlm 没有代理支持( yet !)

在Ntlm与代理使用之前,有些问题需要解决,但无论怎样,这种局面在公司环境中都是非常需要的.

许可证

麻省理工学院

1.1.1 变动

  • 固定头检查为大小写不敏感
  • 将页眉帮助方法创建到 util.js

版本与发布记录

@ewsjs/xhr 共发布 17 个版本,首次发布于 2018/05/02;过去 12 个月发布了 0 个版本。

版本发布日期距今
3.1.3latest2024/05/132 年前
3.1.22024/04/232 年前
3.1.12024/03/252 年前
3.1.02024/03/242 年前
3.0.02024/02/252 年前
2.0.22023/12/052 年前

关于 @ewsjs/xhr 的常见问题

@ewsjs/xhr 是什么?

用于ewsjs的其他 XHR 方法

如何安装 @ewsjs/xhr?

在项目目录运行 npm install @ewsjs/xhr,或使用 pnpm add / yarn add / bun add。

@ewsjs/xhr 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ewsjs/xhr 支持 ESM 还是 CommonJS?

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

@ewsjs/xhr 可以商用吗?

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

@ewsjs/xhr 的下载量有多少?

根据 npm 官方下载统计,@ewsjs/xhr 在 2026/10/14 – 2026/11/12 这 30 天内被下载 241,591 次,日均约 8,053 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ewsjs/xhr 还在维护吗?

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