Supporting HTTP client adapter
See original GitHub issueRight now, the TypeScript generated code uses CoreHttp, which in turn seems to use either XmlHttpRequest
or node-fetch
, depending on what is available.
However, since I am using Appcelerator Titanium to build my app (which is a node-based language but still doesn’t support node’s http
library and therefore doesn’t support node-fetch
either), I am out of options to make the generated code work for my app.
In swaggergen (which I would like to switch away from), it is possible to define an “adapter”. A simple abstraction that (per default) wraps the CoreHttp client, but can be substituted out (dependency inversion principle, open/closed principle).
I think it would be easy to implement in Autorest, and it would allow the library to be used anywhere, while retaining backwards compatibility.
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Fair
I was focusing on the fact that moving to the new Azure Core libraries would remove the dependency on node-fetch and did not pay attention to rest of the issues like “node-based language but still doesn’t support node’s http library”
Can you elaborate on this please?
https://github.com/Azure/autorest.typescript/wiki/Usage-of-Custom-HTTP-Client-&-Pipeline-Policies