@@ -23,6 +23,8 @@ var http = require("http");
2323var https = require ( "https" ) ;
2424var zlib = require ( "zlib" ) ;
2525
26+ var querystring = require ( 'querystring' ) ;
27+
2628/**
2729 * Compatible server version.
2830 *
@@ -63,9 +65,6 @@ function parameters() {
6365 this . options = null ;
6466 this . accuracyMode = null ;
6567
66- //entities parameters
67- this . linked = null ;
68-
6968 //sentiment parameters
7069 this . explain = null ;
7170 this . shortString = null ;
@@ -76,6 +75,9 @@ function parameters() {
7675 //headers
7776 this . customHeaders = null ;
7877
78+ //URL parameters
79+ this . urlParameters = null ;
80+
7981}
8082
8183/**
@@ -102,7 +104,8 @@ parameters.prototype.loadParams = function() {
102104 "options" : this . options ,
103105 "explain" : this . explain ,
104106 "short-string" : this . shortString ,
105- "_customHeaders" : this . customHeaders
107+ "_customHeaders" : this . customHeaders ,
108+ "_urlParameters" : this . urlParameters
106109 } ;
107110
108111 for ( var key in paramJSON ) {
@@ -155,11 +158,23 @@ parameters.prototype.loadFile = function(filePath, loadedParameters, userKey, pr
155158 }
156159 headers [ "X-RosetteAPI-Key" ] = userKey ;
157160
161+ if ( parameters . customHeaders != null ) {
162+ parameters . customHeaders . forEach ( function ( element , index ) {
163+ headers [ element [ 0 ] ] = element [ 1 ] ;
164+ } ) ;
165+ }
166+
167+ var path = urlParts . path ;
168+
169+ if ( parameters . urlParameters != null ) {
170+ path = path + '?' + querystring . stringify ( parameters . urlParameters ) ;
171+ }
172+
158173 var result = new Buffer ( "" ) ;
159174
160175 var options = {
161176 hostname : urlParts . hostname ,
162- path : urlParts . path ,
177+ path : path ,
163178 method : 'POST' ,
164179 headers : headers ,
165180 agent : false
0 commit comments