var text = function (textToWrite) {
  return {
    handle: function (resp) {
      resp.setHeader("Content-Type", "text/plain");
      resp.statusCode = 200;
      resp.write(textToWrite);
    }
  };
};

var json = function (jsonToWrite) {
  return {
    handle: function (resp) {
      resp.setHeader("Content-Type", "application/json");
      resp.statusCode = 200;
      resp.write(jsonToWrite);
    }
  };
};

var response = function (args) {
  var argArray = Array.prototype.slice.call(arguments);
  
  return {
      handle : function (resp) {
        for(var i = 0, l = argArray.length; i < l; ++i) {
          argArray[i].handle(resp);
        }
      }
  };
};

module.exports = {
  text : text,
  json : json,
  response : response
};
@@ -1,12 +1,104 @@
+var writeSuccess = function (resp, data) %7B%0A  resp.statusCode = 200;%0A  resp.write(data);%0A%7D;%0A%0A
 var text = f
@@ -113,32 +113,32 @@
 (textToWrite) %7B%0A
-
   return %7B%0A    h
@@ -224,48 +224,27 @@
     
-resp.statusCode = 200;%0A      resp.write(
+writeSuccess(resp, 
 text
@@ -413,48 +413,27 @@
     
-resp.statusCode = 200;%0A      resp.write(
+writeSuccess(resp, 
 json

Refactor shared success code.