lib/driver.js
function (options, cb, wd, params) {
      // if no cb is given, generate a body with the `desiredCapabilities` object
      if (!cb) {
        // check if we have parameters set up
        if (Object.keys(params).length > 0) {
          return JSON.stringify(params);
        }
        return '';
      }

      // invoke the given callback & stringify
      var data = cb.call(wd, params);
      return data === null ? '{}' : JSON.stringify(data);
    }
function (options, cb, wd, params) {
      // if no cb is given, generate a body with the `desiredCapabilities` object
      if (!cb) {
        // check if we have parameters set up
        if (Object.keys(params).length > 0) {
          return JSON.stringify(params);
        }
        return '';
      }

      // invoke the given callback & stringify
      var data = cb.call(wd, params);
      return data === null ? '{}' : JSON.stringify(data);
    }
function ( options , cb , wd , params ) { // if no cb is given, generate a body with the `desiredCapabilities` object if ( ! cb ) { // check if we have parameters set up if ( Object . keys ( params ) . length > 0 ) { return JSON . stringify ( params ) ; } return '' ; } // invoke the given callback & stringify var data = cb . call ( wd , params ) ; return data === null ? '{}' : JSON . stringify ( data ) ; }
Generates the message body for webdriver client requests of type POST

@method generateBody
@param {object} options Browser options (name, bin path, etc.)
@param {function|undefined} cb Callback function that should be invoked to generate the message body
@param {Dalek.Internal.Webdriver} wd Webdriver base object
@param {object} params Parameters that should be part of the message body
@return {string} body Serialized JSON of body request data
Generates the message body for webdriver client requests of type POST