Skip to content

Commit 576ae9c

Browse files
author
Chris Park
committed
Merge branch 'RCB-418' of git://github.com/SamHausmann/nodejs into SamHausmann-RCB-418
Conflicts: lib/parameters.js package.json
2 parents 7daffe1 + 7f1e4ff commit 576ae9c

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

examples/language.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ api.parameters.customHeaders = [appHeader];
2020
var content = "Por favor Señorita, says the man.";
2121

2222
api.parameters.content = content;
23+
var appHeader = [];
24+
appHeader[0] = "X-RosetteAPI-App"
25+
appHeader[1] = "app";
26+
api.parameters.customHeaders = [appHeader];
2327

2428
api.rosette(endpoint, function(err, res){
2529
if(err){

lib/.Rhistory

Whitespace-only changes.

lib/parameters.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function parameters() {
7070
//morphology
7171
this.morphology = null;
7272

73-
//custom headers
73+
//headers
7474
this.customHeaders = null;
7575

7676
}
@@ -103,7 +103,7 @@ parameters.prototype.loadParams = function() {
103103
"morphology": this.morphology,
104104
"_maxRetries": this.maxRetries,
105105
"_msInterval": this.msInterval,
106-
"customHeaders": this.customHeaders
106+
"_customHeaders": this.customHeaders
107107
};
108108

109109
for (var key in paramJSON) {

lib/rosetteRequest.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ rosetteRequest.prototype.makeRequest = function(requestType, userKey, urlParts,
7171
"X-RosetteAPI-Binding": "nodejs",
7272
"X-RosetteAPI-Binding-Version": BINDING_VERSION
7373
}
74+
75+
if(parameters.loadParams()._customHeaders !== null){
76+
parameters.loadParams()._customHeaders.forEach( function(element, index) {
77+
headers[element[0]] = element[1];
78+
});
79+
80+
}
81+
7482
if (userKey != null) {
7583
headers["X-RosetteAPI-Key"] = userKey;
7684
}

0 commit comments

Comments
 (0)