-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_urban.js
executable file
·77 lines (67 loc) · 1.9 KB
/
test_urban.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
http = require('http')
var querystring = require('querystring');
/*
var options = {
hostname: 'localhost',
port: 5000,
path: '/urbandic',
method: 'POST'
}
*/
var options = {
hostname: 'pmc.fly.dev',
port: 8080,
path: '/urbandic',
method: 'POST'
}
date = new Date()
var post_data = [];
post_data[0] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban kvlt' // test common names
});
post_data[1] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban your mom' // test common names
});
post_data[2] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban æ' // test common names
});
post_data[3] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban 80\'s' // test common names
});
post_data[4] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban brood wars' // test common names
});
post_data[5] = querystring.stringify({
'user_id' : 'U02A2NEUX',
'user_name' : 'boltar',
'timestamp': '1402359176.000029', //date.getTime(),
'text' : '!urban taco bell' // test common names
});
var req = http.request(options, function(res) {
res.setEncoding('utf8')
res.on('data', function (chunk) {
console.log('BODY: ' + chunk)
})
})
req.on('error', function (e) {
console.log('problem with request: ' + e.message)
})
//req.write(post_data[0])
req.write(post_data[5])
//req.write(post_data[4]) --> will fail due to caps
req.end()