From db0e6847875ee891a5d7506d267e733b91ce8e46 Mon Sep 17 00:00:00 2001 From: José Bollo Date: Fri, 12 Oct 2018 18:51:31 +0200 Subject: AFB.html: Allow to call any verb of any API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I3bfff2632d5854d5885740e55f0ec38fe3214424 Signed-off-by: José Bollo --- test/AFB.html | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'test/AFB.html') diff --git a/test/AFB.html b/test/AFB.html index b0832d9a..ef2dc586 100644 --- a/test/AFB.html +++ b/test/AFB.html @@ -27,10 +27,16 @@ function gotevent(obj) { document.getElementById("outevt").innerHTML = JSON.stringify(obj); } - function send(message) { + function sendform() { var api = document.getElementById("api").value; var verb = document.getElementById("verb").value; - ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr); + var message = document.getElementById("message").value; + try { + var data = JSON.parse(message); + ws.call(api+"/"+verb, data).then(replyok, replyerr); + } catch(e) { + document.getElementById("output").innerHTML = "INVALID JSON ("+e+"): "+message; + } } @@ -38,10 +44,14 @@

WebSocket Echo

Not Connected
-- cgit 1.2.3-korg