From 22242cf4ed16ffe60973fb06bdd8bde8ad3fa734 Mon Sep 17 00:00:00 2001 From: Chris Hill Date: Fri, 15 Jul 2016 14:28:32 -0400 Subject: [PATCH] I needed to tweak this this to get PUT and POSTs to work in the Node.js sample. --- sample/GettingStartedSample_Node.js/public/index.html | 4 ++-- sample/GettingStartedSample_Node.js/server.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sample/GettingStartedSample_Node.js/public/index.html b/sample/GettingStartedSample_Node.js/public/index.html index 46a17b8..ae144f7 100644 --- a/sample/GettingStartedSample_Node.js/public/index.html +++ b/sample/GettingStartedSample_Node.js/public/index.html @@ -208,10 +208,10 @@ path: call.path, auth: auth.search, userId: auth.userId, - userKey: auth.userKey + userKey: auth.userKey, + body: useBody() && call.body || '' }) .type('json') - .send(useBody() && call.body || '') .end(function (err, res) { document.getElementById('resultStatus').textContent = res.status; document.getElementById('resultBody').textContent = JSON.stringify(res.body, undefined, '\t'); diff --git a/sample/GettingStartedSample_Node.js/server.js b/sample/GettingStartedSample_Node.js/server.js index 0c27437..e734d18 100644 --- a/sample/GettingStartedSample_Node.js/server.js +++ b/sample/GettingStartedSample_Node.js/server.js @@ -64,7 +64,7 @@ app if (['post', 'put'].indexOf(method) !== -1) { apiCall.type('application/json'); - req.pipe(apiCall); + apiCall.send(req.param('body')); } apiCall.end(function (err, apiRes) {