Created
March 23, 2021 09:38
-
-
Save fgalan/190c09843be26ddb8be5061c9d91bb10 to your computer and use it in GitHub Desktop.
test-request-simple.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const http = require('http') | |
const data = JSON.stringify({"id":"E","type":"T","location":{"type":"geo:json","value":{"type":"Point","coordinates":[32.124,-5.218]}},"address":{"type":"String","value":"House"},"TimeInstant":{"type":"DateTime","value":"2021-03-22T08:26:49.566Z"}}) | |
const data2 = JSON.stringify({"id":"E","type":"T","TimeInstant":{"type":"DateTime","value":"2021-03-22T08:26:49.530Z"}}) | |
const options = { | |
hostname: 'localhost', | |
port: 1026, | |
path: '/v2/entities?options=upsert', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Content-Length': data.length | |
} | |
} | |
const options2 = { | |
hostname: 'localhost', | |
port: 1026, | |
path: '/v2/entities?options=upsert', | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/json', | |
'Content-Length': data2.length | |
} | |
} | |
const req = http.request(options) | |
const req2 = http.request(options2) | |
req.write(data) | |
req2.write(data2) | |
req.end() | |
req2.end() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment