FEA Support Axios 'fetch' adapter in order to support more serverless platforms

未关闭
#740 4 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
22/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
nodejs, typescript
领域
api

调研方向

The axios adapter is set through XeroClient.ts, so start there and look at how the HTTP client is created at configuration time. Run npm test first, then set the adapter to fetch as the issue describes to reproduce the three reported failures. Done would mean either an optional configuration parameter or a documented fetch default that keeps the test suite passing. The maintainers have not settled whether to add an option or change the default in v11, so confirm that choice before writing code.

由索引模型根据 Issue 内容生成。

描述

SDK you're using (please complete the following information):

  • Version 10.0.0

Is your feature request related to a problem? Please describe.
Serverless platforms (specifically Cloudflare Workers/Pages) may not support some of all of the 'http' functions. In the CF case, they do not fully support the HTTPS handling. (They do support the fetch variation).

Describe the solution you'd like
Enable xero-node to set the axios adapter to the 'fetch' adapter (which is now built-in) at configuration time. It may be necessary to add an addiitonal optional parameter to XeroClient to set this value. Alternatively, the whole project may prefer to use fetch by default in v11.

Describe alternatives you've considered

  1. There does not appear to be a way to override the axios adapter without explicit code changes
  2. Axios detects 'http' because CF mocks it, but CF does not fully implement it. This means, the http adapter is chosen as the default, but later functions fail.

Additional context
Quick code validation:

  1. run the xero-node tests: npm test (all pass)
  2. Add this to line 6 of the XeroClient.ts file: axios.defaults.adapter = 'fetch';
  3. Run tests again - 3 failures

Image

主要语言
TypeScript
星标
264
派生
177
平均合并
10 小时 5 分钟
30 天内合并 PR
5

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

XeroAPI/xero-node 的其他 Issue

查看 XeroAPI/xero-node 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。