From 29f98d8d043bbebccfe75542f92d9d02358ed971 Mon Sep 17 00:00:00 2001 From: Mike Levine Date: Wed, 29 Jun 2016 12:57:16 -0700 Subject: [PATCH] Use PATCH instead of PUT for modify. While it is arguable more proper in REST to have modify do a PUT, in tmsh, and therefore iControl REST, modify is a PATCH. For example, do a tmsh modify sys global-settings: only what you set is modified. But do a PUT to /mgmt/tm/sys/global-settings and items you don't set (mgmtDhcp, for example) will be set. --- lib/iControl.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/iControl.js b/lib/iControl.js index 335089a..aa96d39 100644 --- a/lib/iControl.js +++ b/lib/iControl.js @@ -56,7 +56,7 @@ iControl.prototype.create = function(path, body, cb) { // Modify iControl.prototype.modify = function(path, body, cb) { - var opts = { path: path, body: body, method: 'PUT' }; + var opts = { path: path, body: body, method: 'PATCH' }; this._request(opts, cb); }; @@ -112,7 +112,7 @@ iControl.prototype._request = function(opts, cb) { return cb(msg, false); } - + // If retrieving via GET, handle pagination if (this.method === 'GET') { @@ -126,7 +126,7 @@ iControl.prototype._request = function(opts, cb) { return cb(false, body); } } - + // For POST/PUT/DELETE, return body else { return cb(false, body);