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 client = require("../client");
var util = require("util");
/*section: host /*section: host
*comment: mute the given host, if it is not already muted *comment: mute the given host, if it is not already muted
@ -27,22 +28,22 @@ function mute(hostname, options, callback){
callback = options; callback = options;
options = {}; options = {};
} }
var params = {
body: {
hostname: hostname
}
};
var params = {};
if(typeof options === "object"){ if(typeof options === "object"){
params.body = {}; // create body property
if(options.end){ if(options.end){
params.body.end = parseInt(options.end); params.body.end = parseInt(options.end);
} }
if(options.override){ if(options.override){
params.body.override = 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 /*section: host
*comment: unmute the given host, if it is not already unmuted *comment: unmute the given host, if it is not already unmuted
*params: *params:
@ -62,12 +63,8 @@ function mute(hostname, options, callback){
* ``` * ```
*/ */
function unmute(hostname, 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 = { module.exports = {


Loading…
Cancel
Save