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

Aperta
#740 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
22/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
nodejs, typescript
Ambito
api

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

Lingua principale
TypeScript
Stelle
264
Fork
177
Merge medio
10h 5m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di XeroAPI/xero-node

Tutte le issue di XeroAPI/xero-node

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.