emscripten icon indicating copy to clipboard operation
emscripten copied to clipboard

XMLHttpRequest for restful api calls. (not using the fetch API)

Open ziocleto opened this issue 8 years ago • 2 comments

Hi, we have forked emscripten and implemented a small XMLHttpRequest library to perform api calls to webservices that used a RESTFUL interface.

There are few things we could NOT do it with the provided Fetch API: (Or the *wget and *wget2 helpers)

  • using credentials (ie cookies, jwt, client certificate etc)
  • using the full rest methods such as PUT,DELETE,OPTION,etc...
  • using POST to send and receive data with different content-types.

So what we ended up with is a generic XMLHttpRequest helper that lets you add headers, credentials, content-type (POST in wget and wget2 is limited to x-www-form-urlencoded) via a unified interface. It uses the same callbacks as wget* so it's nice and easy to just drop and replace from your code.

(Just be clear I do not want to duplicate any feature of the fetch API but I think the fecth API is not the right place for XHR api calls)

Is this something you would be interested in a PR or are there already solutions to it?

ziocleto avatar Nov 29 '18 13:11 ziocleto

cc @juj

kripken avatar Nov 29 '18 17:11 kripken

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 7 days. Feel free to re-open at any time if this issue is still relevant.

stale[bot] avatar Nov 29 '19 18:11 stale[bot]