@@ -10,6 +10,7 @@ var KongService = {
1010 create : function ( req , res ) {
1111
1212 unirest . post ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
13+ . header ( 'Content-Type' , 'application/json' )
1314 . send ( req . body )
1415 . end ( function ( response ) {
1516 if ( response . error ) return res . kongError ( response )
@@ -20,6 +21,7 @@ var KongService = {
2021 createCb : function ( req , res , cb ) {
2122
2223 unirest . post ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
24+ . header ( 'Content-Type' , 'application/json' )
2325 . send ( req . body )
2426 . end ( function ( response ) {
2527 if ( response . error ) return cb ( response )
@@ -44,6 +46,7 @@ var KongService = {
4446
4547 retrieve : function ( req , res ) {
4648 unirest . get ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
49+ . header ( 'Content-Type' , 'application/json' )
4750 . end ( function ( response ) {
4851 if ( response . error ) return res . kongError ( response )
4952 return res . json ( response . body )
@@ -52,6 +55,7 @@ var KongService = {
5255
5356 nodeStatus : function ( node , cb ) {
5457 unirest . get ( node . kong_admin_url + "/status" )
58+ . header ( 'Content-Type' , 'application/json' )
5559 . end ( function ( response ) {
5660 if ( response . error ) return cb ( response )
5761 return cb ( null , response . body )
@@ -61,6 +65,7 @@ var KongService = {
6165 listAllCb : function ( req , endpoint , cb ) {
6266 var getData = function ( previousData , url ) {
6367 unirest . get ( url )
68+ . header ( 'Content-Type' , 'application/json' )
6469 . end ( function ( response ) {
6570 if ( response . error ) return cb ( response )
6671 var data = previousData . concat ( response . body . data ) ;
@@ -80,6 +85,7 @@ var KongService = {
8085 list : function ( req , res ) {
8186 var getData = function ( previousData , url ) {
8287 unirest . get ( url )
88+ . header ( 'Content-Type' , 'application/json' )
8389 . end ( function ( response ) {
8490 if ( response . error ) return res . kongError ( response )
8591 var apis = previousData . concat ( response . body . data ) ;
@@ -97,6 +103,7 @@ var KongService = {
97103
98104 update : function ( req , res ) {
99105 unirest . patch ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
106+ . header ( 'Content-Type' , 'application/json' )
100107 . send ( req . body )
101108 . end ( function ( response ) {
102109 if ( response . error ) return res . kongError ( response )
@@ -114,6 +121,7 @@ var KongService = {
114121
115122 updateCb : function ( req , res , cb ) {
116123 unirest . patch ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
124+ . header ( 'Content-Type' , 'application/json' )
117125 . send ( req . body )
118126 . end ( function ( response ) {
119127 if ( response . error ) return cb ( response )
@@ -132,6 +140,7 @@ var KongService = {
132140
133141 updateOrCreate : function ( req , res ) {
134142 unirest . put ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
143+ . header ( 'Content-Type' , 'application/json' )
135144 . send ( req . body )
136145 . end ( function ( response ) {
137146 if ( response . error ) return res . kongError ( response )
@@ -141,6 +150,7 @@ var KongService = {
141150
142151 delete : function ( req , res ) {
143152 unirest . delete ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
153+ . header ( 'Content-Type' , 'application/json' )
144154 . end ( function ( response ) {
145155 if ( response . error ) return res . kongError ( response )
146156
@@ -160,6 +170,7 @@ var KongService = {
160170
161171 deleteCb : function ( req , res , cb ) {
162172 unirest . delete ( sails . config . kong_admin_url + req . url . replace ( '/kong' , '' ) )
173+ . header ( 'Content-Type' , 'application/json' )
163174 . end ( function ( response ) {
164175 if ( response . error ) return cb ( response )
165176
0 commit comments