Skip to content

Commit c440d89

Browse files
Merge pull request #120 from splunk/DVPL-9508
JS Dependancies & jQuery update
2 parents 67d5fb1 + 2a91175 commit c440d89

File tree

384 files changed

+19736
-16742
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

384 files changed

+19736
-16742
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SPLUNK_HOME="/opt/splunk"

CREDITS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ Some of the components included in the Splunk Enterprise SDK for JavaScript are
1414
| [commander](https://github.com/visionmedia/commander.js/) | Node.js command-line interfaces | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-COMMANDER) |
1515
| [script.js](https://github.com/ded/script.js/) | Asyncronous JavaScript loader and dependency manager | [Apache](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-SCRIPTJS) |
1616
| [base64.js](http://code.google.com/p/javascriptbase64/) | Fast base64 encoding/decoding | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-BASE64) |
17+
| [dotenv](https://github.com/motdotla/dotenv) | Loads environment varibles from .env file | [BSD 2-Clause](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-DOTENV) |
18+
| [cookie](https://github.com/jshttp/cookie) | HTTP cookie parser and serializer for HTTP servers | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-COOKIE) |
19+
| [elementtree](https://github.com/racker/node-elementtree) | Node.js XML parserer and serializer | [Apache-2.0](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-ELEMENTTREE) |
20+
| [needle](https://github.com/tomas/needle) | Node.js http client | [MIT](https://github.com/splunk/splunk-sdk-javascript/blob/master/licenses/LICENSE-NEEDLE) |

bin/cli.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
var http = require('http');
2727
var url = require('url');
2828
var request = require('request');
29+
var needle = require('needle');
2930

3031
/**
3132
* Constants
@@ -101,29 +102,33 @@
101102
method: req.method,
102103
headers: {
103104
"Content-Length": req.headers["content-length"] || 0,
104-
"Content-Type": req.headers["content-type"],
105-
"Authorization": req.headers["authorization"]
105+
"Content-Type": req.headers["content-type"] || '',
106+
"Authorization": req.headers["authorization"] || ''
106107
},
107108
followAllRedirects: true,
108-
body: body,
109+
body: body || '',
109110
jar: false,
110-
strictSSL: false
111+
strictSSL: false,
112+
rejectUnauthorized : false,
113+
parse_response : false
111114
};
112115

113116
try {
114-
request(options, function(err, response, data) {
117+
needle.request(options.method, options.url, options.body, options, function(err, response, body)
118+
{
115119
try {
116120
var statusCode = (response ? response.statusCode : 500) || 500;
117121
var headers = (response ? response.headers : {}) || {};
118122

119123
res.writeHead(statusCode, headers);
120-
res.write(data || JSON.stringify(err));
124+
res.write(body || JSON.stringify(err));
121125
res.end();
122126
}
123127
catch (ex) {
124128
writeError();
125129
}
126130
});
131+
127132
}
128133
catch (ex) {
129134
writeError();

0 commit comments

Comments
 (0)