summaryrefslogtreecommitdiff
path: root/javascript/spec/specHelper.js
blob: 5f8071dc7395b7c774655ca19b3e37ef2ce55163 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var specHelper = (function() {
  // HELPERS

  function respondXML(request, content) {
    header = { "Content-Type": "application/xml;charset=utf-8" };
    body = '<?xml version="1.0" encoding="UTF-8"?>\n';
    body += content;
    request.respond(200, header, body);
  }

  function respondJSON(request, object) {
    header = { "Content-Type": "application/json;charset=utf-8" };
    body = JSON.stringify(object);
    request.respond(200, header, body);
  } 

  return {
    respondJSON: respondJSON,
    respondXML: respondXML
  }

})();