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

Abierto
#740 4 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
22/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
nodejs, typescript
Área
api

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
TypeScript
Estrellas
264
Forks
177
Merge medio
10 h 5 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de XeroAPI/xero-node

Todos los issues de XeroAPI/xero-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.