From 2c46da962ba8559279647f9e077b6cce83e05278 Mon Sep 17 00:00:00 2001 From: sbosse Date: Tue, 27 Aug 2024 00:16:08 +0200 Subject: [PATCH] Tue 27 Aug 00:14:56 CEST 2024 --- test/test-http-POST.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/test-http-POST.js diff --git a/test/test-http-POST.js b/test/test-http-POST.js new file mode 100644 index 0000000..1032606 --- /dev/null +++ b/test/test-http-POST.js @@ -0,0 +1,21 @@ +// ag-0.de: # /opt/node-v10.23.1-linux-x86/bin/node WWW/software/wclbot +CleverBot = { + ask : function (line,cb) { + http.POST(CleverBot.url,{ + say:line, + session:CleverBot.session, + context:CleverBot.context + }, function (response) { + // console.log(response); + CleverBot.session=response.session; + CleverBot.context.push(line); CleverBot.context.push(response.answer); + cb(response.answer) + }); + }, + context : [], + reset : function () { CleverBot.session=null;CleverBot.context=[] }, + session : null, + url : 'http://ag-0.de:12121', +} +print('Asking cleverbot: Who are you? Answer:'); +CleverBot.ask('Who are you?',print);