snapi2
Version:
An API-first RESTful server framework built on Swagger and Restify
33 lines (24 loc) • 1.11 kB
JavaScript
// Generated by CoffeeScript 1.12.7
var RedirectResponse, Response, responder,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
responder = require('./responder');
exports.Response = Response = (function() {
function Response(body, headers, statusCode) {
this.body = body != null ? body : null;
this.headers = headers != null ? headers : {};
this.statusCode = statusCode != null ? statusCode : 200;
}
return Response;
})();
exports.RedirectResponse = RedirectResponse = (function(superClass) {
extend(RedirectResponse, superClass);
function RedirectResponse(uri, statusCode) {
this.uri = uri;
this.statusCode = statusCode != null ? statusCode : 301;
RedirectResponse.__super__.constructor.call(this, null, {
Location: this.uri
}, this.statusCode);
}
return RedirectResponse;
})(Response);