From 4c37de3c177072d1a16bdf52455b5010d224c891 Mon Sep 17 00:00:00 2001 From: gcorradini Date: Sun, 6 Nov 2016 06:05:58 -0800 Subject: [PATCH] keithwhor/nodal#300: implement feedback from PR #301 --- core/mocha/endpoint_request.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/core/mocha/endpoint_request.js b/core/mocha/endpoint_request.js index 2f9d64c7..f57002d4 100644 --- a/core/mocha/endpoint_request.js +++ b/core/mocha/endpoint_request.js @@ -23,7 +23,7 @@ class EndpointRequest { '::1', this.url, method, - Object.keys(headers || {}).reduce(function(accum, curr){ headers[curr.toLowerCase()] = headers[curr]; return headers;},{}), + Object.keys(headers || {}).reduce(function(a, c){ headers[c.toLowerCase()] = headers[c]; return headers;},{}), body ), (err, status, headers, body) => { @@ -50,25 +50,37 @@ class EndpointRequest { } - get(callback, headers) { + get(callback) { - this.mock('GET', null, headers, callback); + this.mock('GET', null, null, callback); } - del(callback, headers) { + del(callback) { - this.mock('DELETE', null, headers, callback); + this.mock('DELETE', null, null, callback); } - post(body, callback, headers) { + post(body, callback) { + + this.mock('POST', body, {'Content-Type': 'application/json'}, callback); + + } + + postHead(body, headers, callback){ this.mock('POST', body, headers, callback); } - put(body, callback, headers) { + put(body, callback) { + + this.mock('PUT', body, {'Content-Type': 'application/json'}, callback); + + } + + putHead(body, headers, callback) { this.mock('PUT', body, headers, callback);