How would I turn this curl request into an ajax call in javascript? (an answer in raw js or any library is fine)
curl:
curl -H "Content-Type: application/json" -d '{"foo":0, "bar": 0, "baz":"test"}' -X GET http://localhost:8080/public/v1/state/HelloWorld
The URL I tried in my ajax call (it gives a 404 error):
GET http://192.168.56.101:8080/public/v1/state/HelloWorld?foo=0&bar=0&baz=test
Code
return axios.get(switchDomain + '/public/v1/state/HelloWorld', {
params: {
foo: 0,
bar: 0,
baz: "BER",
}
})
.then(function(response){
console.log('perf response', response);
});