@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