Javascript XMLHttpRequest Client implementation #172
Conversation
@@ -0,0 +1,41 @@ | |||
(* | |||
* Copyright (c) 2012-2013 Anil Madhavapeddy <anil@recoil.org> |
avsm
Sep 7, 2014
Member
should be copyright you here
should be copyright you here
len : int; | ||
} | ||
|
||
module String_io = struct |
avsm
Sep 7, 2014
Member
nice, I'll pull this out into so that we can have a StringCohttp pre-applied as well.
nice, I'll pull this out into so that we can have a StringCohttp pre-applied as well.
I've removed the Lwt from the String IO implementation (using In #173 |
Would you have a simple test case for the JS backend? |
Does it need to be automated? I can provide a very simple test case you could run manually from a browser and, say, do a simple github query. Automated is a bit harder. I think you can run js_of_ocaml on node.js (or it's been talked about anyway) in which case there are XHR implementations for it which may work. |
Manual is just fine!
|
So here's a simple test using Cohttp_lwt_xhr to query a users github repositories and display the resulting JSON. Note; requires Yojson to pretty print the result which may not be a dependency you want. |
Ta! Ezjsonm is probably better since it doesn't do any obj magic -- I'll fix it up locally
|
I'm not convinced it does - I think that was just atdgen. I was more thinking about having a dependency thats not in cohttp itself. Actually I think theres some json stringify magic in javascript which would do this as well. |
ityw JSON.stringify(...) On 7 September 2014 15:16, Andrew Ray notifications@github.com wrote:
Richard Mortier |
I think this version is a bit better. It also now prints the response headers which I think will be useful for debugging. Some stuff still to do;
|
This is an attempt to use XMLHttpRequest to make client HTTP calls from javascript programs via cohttp.
It has been lightly tested with ocaml-github where it is able to query the github API. Much still to be tested but perhaps this could be useful.