-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
30 lines (29 loc) · 925 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var request = require('request');
var test_data = require('./test_data');
request({
url: 'https://app.close.io/hackwithus/', //URL to hit
qs: {
// no query string
},
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Custom-Header': 'Test'
},
body: JSON.stringify(test_data),
}, function(error, response, body) {
console.log('Status Code: ' + response.statusCode);
if(error) {
console.log('-------------------------------------------------')
console.log('Failure')
console.log('-------------------------------------------------')
console.log(error);
}
else {
console.log('-------------------------------------------------')
console.log('Success')
console.log('-------------------------------------------------')
// console.log(response);
console.log(body);
}
});