Details
-
Type: Monitor
-
Status: Closed
-
Priority: Major
-
Resolution: Done
-
Affects Version/s: None
-
Fix Version/s: 2021
-
Component/s: FIWARE-TECH-HELP
-
HD-Enabler:Orion
Description
Created question in FIWARE Q/A platform on 25-03-2019 at 11:03
Please, ANSWER this question AT https://stackoverflow.com/questions/55335716/error-when-i-triying-to-do-a-post-request
Question:
Error when I triying to do a POST request
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've Context-Length header in the request.
This is de 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":
,
"pressure":
};
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:
,
data: jsonObject
};
request(peticion, function(error, response, body)
{ console.log(error); console.log(body); });
Activity
- All
- Comments
- History
- Activity
- Transitions