1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- var http=require('http');
-
-
-
- var post_data={"query":{"match":{"imtype":"LTCUS"}},"sort":[{"rtdatetime":{"order":"desc"}}],
- "size":3}
-
- var content=JSON.stringify(post_data);
-
-
-
- var options = {
-
- host: 'localhost',
-
- port: 8081,
-
- path: '/?a={1}',
-
- method: 'POST',
-
- headers:{
-
- 'Content-Type':'application/json',
-
- 'Content-Length':content.length
-
- }
-
- };
- options.path += '&b=2'
-
- console.log("post options:\n",options);
-
- console.log("content:",content);
-
- console.log("\n");
-
-
-
- var req = http.request(options, function(res) {
-
- console.log("statusCode: ", res.statusCode);
-
- console.log("headers: ", res.headers);
-
- var _data='';
-
- res.on('data', function(chunk){
-
- _data += chunk;
-
- });
-
- res.on('end', function(){
-
- console.log("\n--->>\nresult:",_data)
-
- });
-
- });
-
-
-
- req.write(content);
-
- req.end();
|