Skip to content

Commit

Permalink
Specifying a server header value
Browse files Browse the repository at this point in the history
  • Loading branch information
avoidwork committed Mar 30, 2016
1 parent 0dff97d commit 68a89da
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/renderers.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ renderers.set("text/html", function (arg, req, headers, tpl) {
return i.indexOf("html") === -1;
}).map(function (i) {
return "<option value='" + i + "'>" + i.replace(/^.*\//, "").toUpperCase() + "</option>";
}).join("\n")).replace("{{body}}", JSON.stringify(arg, null, 2)).replace("{{year}}", new Date().getFullYear()).replace("{{version}}", "3.3.3").replace("{{allow}}", headers.allow).replace("{{methods}}", utility.explode(headers.allow.replace("GET, HEAD, OPTIONS", "")).filter(function (i) {
}).join("\n")).replace("{{body}}", JSON.stringify(arg, null, 2)).replace("{{year}}", new Date().getFullYear()).replace("{{version}}", "3.3.4").replace("{{allow}}", headers.allow).replace("{{methods}}", utility.explode(headers.allow.replace("GET, HEAD, OPTIONS", "")).filter(function (i) {
return i !== "";
}).map(function (i) {
return "<option value='" + i + "'>" + i + "</option>";
Expand Down
7 changes: 5 additions & 2 deletions lib/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@ var renderers = require(path.join(__dirname, "renderers")),
serializers = require(path.join(__dirname, "serializers"));

var Tenso = function () {
function Tenso(config) {
function Tenso() {
var _this = this;

var config = arguments.length <= 0 || arguments[0] === undefined ? { headers: {} } : arguments[0];

_classCallCheck(this, Tenso);

config.headers.server = "tenso/3.3.4";
this.coap = null;
this.hostname = "";
this.rates = {};
Expand All @@ -30,7 +33,7 @@ var Tenso = function () {
});
this.server.tenso = this;
this.websocket = null;
this.version = "3.3.3";
this.version = "3.3.4";
}

_createClass(Tenso, [{
Expand Down
2 changes: 1 addition & 1 deletion lib/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ function bootstrap(obj, config) {
config.headers = {};
}

config.headers.server = "tenso/3.3.3";
config.headers.server = "tenso/3.3.4";

// Starting WebSocket server
if (config.websocket.enabled) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "tenso",
"description": "Tensō is a REST API gateway for node.js, designed to simplify the implementation of APIs.",
"version": "3.3.3",
"version": "3.3.4",
"homepage": "http://avoidwork.github.io/tenso",
"author": "Jason Mulligan <[email protected]>",
"repository": {
Expand Down
3 changes: 2 additions & 1 deletion src/tenso.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ let renderers = require(path.join(__dirname, "renderers")),
serializers = require(path.join(__dirname, "serializers"));

class Tenso {
constructor (config) {
constructor (config = {headers: {}}) {
config.headers.server = "tenso/{{VERSION}}";
this.coap = null;
this.hostname = "";
this.rates = {};
Expand Down

0 comments on commit 68a89da

Please sign in to comment.