From 383c82dae2142e0c71a4dc8416da80ab3d0b7f85 Mon Sep 17 00:00:00 2001 From: Ulf Bjorkengren Date: Sat, 6 Jan 2024 17:00:47 +0100 Subject: [PATCH] Bug fixes. Signed-off-by: Ulf Bjorkengren --- client/client-1.0/Javascript/atclient.html | 5 ++++- server/vissv2server/atServer/atServer.go | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/client/client-1.0/Javascript/atclient.html b/client/client-1.0/Javascript/atclient.html index 464f6344..d8601a41 100644 --- a/client/client-1.0/Javascript/atclient.html +++ b/client/client-1.0/Javascript/atclient.html @@ -37,11 +37,14 @@

AT client example

function sendPost() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { + if (this.readyState == 4 && this.status == 201) { postOutput.innerHTML += "Server: " + this.responseText + "\n"; } }; var params = postValue.value; + console.log("params: " + params); + console.log("postpath: " + postPath.value); + xhttp.open("POST", "http://" + hostIP + ":8600/" + postPath.value, true); xhttp.send(params); postPath.value = ""; diff --git a/server/vissv2server/atServer/atServer.go b/server/vissv2server/atServer/atServer.go index b2a02436..c3c253c9 100644 --- a/server/vissv2server/atServer/atServer.go +++ b/server/vissv2server/atServer/atServer.go @@ -167,7 +167,7 @@ func makeAtServerHandler(atsChannel chan string) func(http.ResponseWriter, *http http.Error(w, "400 bad input.", 400) } else { w.Header().Set("Access-Control-Allow-Origin", "*") - // w.Header().Set("Content-Type", "application/json") + w.Header().Set("Content-Type", "application/json") w.WriteHeader(201) // USE 201 when responding to succesful POST requests w.Write([]byte(response)) } @@ -1365,7 +1365,7 @@ func AtServerInit(viss2Chan chan string, viss2CancelChan chan string, vssRootRef gatingId := purgeLists() if gatingId != "" { viss2CancelChan <- gatingId - } else + } } } }