Browse Source

pass hostname in the url instead of the POST body

pull/54/head
alexcreek 9 years ago
parent
commit
e4c39ca6f7
1 changed files with 9 additions and 12 deletions
  1. +9
    -12
      lib/api/host.js

+ 9
- 12
lib/api/host.js View File

@ -1,4 +1,5 @@
var client = require("../client");
var util = require("util");
/*section: host
*comment: mute the given host, if it is not already muted
@ -27,22 +28,22 @@ function mute(hostname, options, callback){
callback = options;
options = {};
}
var params = {
body: {
hostname: hostname
}
};
var params = {};
if(typeof options === "object"){
params.body = {}; // create body property
if(options.end){
params.body.end = parseInt(options.end);
}
if(options.override){
params.body.override = options.override;
}
} else {
params.body = ""; // create empty body
}
client.request("POST", "/host", params, callback);
client.request("POST", util.format("/host/%s/mute", hostname), params, callback);
}
/*section: host
*comment: unmute the given host, if it is not already unmuted
*params:
@ -62,12 +63,8 @@ function mute(hostname, options, callback){
* ```
*/
function unmute(hostname, callback){
var params = {
body: {
hostname: hostname
}
};
client.request("POST", "/host", params, callback);
var params = {body: ""}; // create empty body
client.request("POST", util.format("/host/%s/unmute", hostname), params, callback);
}
module.exports = {


Loading…
Cancel
Save