Skip to content

Instantly share code, notes, and snippets.

@fgalan
Created March 23, 2021 09:38
Show Gist options
  • Save fgalan/190c09843be26ddb8be5061c9d91bb10 to your computer and use it in GitHub Desktop.
Save fgalan/190c09843be26ddb8be5061c9d91bb10 to your computer and use it in GitHub Desktop.
test-request-simple.js
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