ringo/ringojs — pull request #211 by botic (2013-01-25 14:07:31+00:00)
Title: Chainable JSGI response helper

This pull request targets issue #208 and tries to enhance the way to create a simple JSGI response. Instead of using a fixed set of function it provides a chainable JsgiResponse.

If you like this way, I will add unit tests in an update of this pull request.

```javascript
app.get("/test/text", function(req) {
return response.text("Bad boy!").bad();
});

app.get("/test/html", function(req) {
return response.html("

Bad boy!

").status(200).commit();
});

app.get("/test/json", function(req) {
return response.json({"hello": "world"}).status(200).commit();
});

app.get("/test/headers", function(req) {
return response.json({"hello": "world"}).headers({"x-foo": "bar"}).ok();
});

app.get("/test/redirect", function(req) {
return response.redirect("http://ringojs.org");
});

app.get("/test/notmodified", function(req) {
return response.notModified();
});

app.get("/test/static", function(req) {
return response.static("./api/root.js");
});
```