Saturday 13 May 2017

Why making this Hurl.it HTTP request generates 400 Bad Request

Im trying to simulate a POST request using Hurl.it. Im supposed to be passing in a json parsed by this nodejs:

https://github.com/quique123/aismarthome/blob/master/app.js

app.post('/api/switches/:id', function(req, res){
   console.log('headers: ' + JSON.stringify(req.headers));
   console.log('body: ' + JSON.stringify(req.body));
   console.log('params: ' + JSON.stringify(req.params));
   const assistant = new Assistant({request: req, response: res});
   let soc = assistant.getArgument('state-of-component');
   let comp = assistant.getArgument('Component');
...})

Here are the results of Hurl.it: POST

...



via marciokoko

No comments:

Post a Comment