[ https://jira.fiware.org/browse/HELP-15613?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=113237#comment-113237 ] Fernando Lopez commented on HELP-15613: --------------------------------------- Duplicated issue > [fiware-stackoverflow] Error when I'm trying to do a POST request in Fiware > ------------------------------------------------------------------------------- > > Key: HELP-15613 > URL: https://jira.fiware.org/browse/HELP-15613 > Project: Help-Desk > Issue Type: Monitor > Components: FIWARE-TECH-HELP > Reporter: Backlog Manager > Assignee: Fernando Lopez > Labels: fiware, post, request > > Created question in FIWARE Q/A platform on 25-03-2019 at 11:03 > {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55335716/error-when-im-trying-to-do-a-post-request-in-fiware > +Question:+ > Error when I'm trying to do a POST request in Fiware > +Description:+ > I'm developing a script to do a POST request to Orion Context Broker of Fiware. The problem is that a receive an error: > "ContextLengthRequired" > , but I have Context-Length header in the request. > This is the error when I tried node fiware.js > { > "error":"ContentLengthRequired", > "description":"Zero/No Content-Length in PUT/POST/PATCH request" > } > This is the code in the file fiware.js: > var request = require('request'); > var entity = { > "id": "Room6", > "type": "Room", > "temperature": { > "value": 23, > "type": "Float" > }, > "pressure": { > "value": 700, > "type": "Float" > } > }; > var jsonObject = JSON.stringify(entity); > var aux = jsonObject.toString(); > aux = aux.length; > var peticion = { > url: "http://127.0.0.1:1026/v2/entities", > method: "POST", > headers: { > "Content-Length": aux, > "Content-Type": "application/json" > }, > data: jsonObject > }; > request(peticion, function(error, response, body) { > console.log(error); > console.log(body); > }); -- This message was sent by Atlassian JIRA (v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy