code: function mockResponseHeaders (req, res, next) {
    if (res.swagger) {
      util.debug("Setting %d response headers...", _.keys(res.swagger.headers).length);
  
      if (res.swagger.headers) {
        _.forEach(res.swagger.headers, (header, name) => {
          // Set all HTTP headers that are defined in the Swagger API.
          // If a default value is specified in the Swagger API, then use it; otherwise generate a value.
          if (res.get(name) !== undefined) {
            util.debug("    %s: %s (already set)", name, res.get(name));
          }
          else if (header.default !== undefined) {
            res.set(name, header.default);
            util.debug("    %s: %s (default)", name, header.default);
          }
          else {
            switch (name.toLowerCase()) {
              case "location":
                res.location(req.baseUrl + (res.swagger.location || req.path));
                break;
              case "last-modified":
                res.set(name, util.rfc1123(res.swagger.lastModified));
                break;
              case "content-disposition":
                res.set(name, 'attachment; filename="' + path.basename(res.swagger.location || req.path) + '"');
                break;
              case "set-cookie":
                // Generate a random "swagger" cookie, or re-use it if it already exists
                if (req.cookies.swagger === undefined) {
                  res.cookie("swagger", _.uniqueId("random") + _.random(99999999999.9999));
                }
                else {
                  res.cookie("swagger", req.cookies.swagger);
                }
                break;
              default:
                // Generate a sample value from the schema
                let sample = new JsonSchema(header).sample();
                if (_.isDate(sample)) {
                  res.set(name, util.rfc1123(sample));
                }
                else {
                  res.set(name, _(sample).toString());
                }
            }
            util.debug("    %s: %s", name, res.get(name));
          }
        });
      }
    }
  
    next();
  }
docs: Sets response headers, according to the Swagger API.