jfromaniello/Anna — pull request #1 by eteeselink (2011-10-08 15:26:22+00:00)
Title: OMG open source contributions!

Hi Jose,

I really like Anna, so I spent some saturday time on hacking on it. Things I added / changed:

* I added a `GetBody()` method to `Request`, which asynchronously reads the input stream into a string (in a single go, so not very suited for large uploads, but very handy for HTML form posts and RESTful APIs and the likes). I guess it can be improved a lot, but hey, it's a start.
* I must admit that I didn't really like the way responses were implemented, with the implicit conversions and all: these are very difficult to discover from the IDE. You need to read examples or the source to see how to use it. So I rewrote it to simple methods on `RequestContext`.
* I added a `Send` method to the `Response` class. Advantage is that logically, I believe that this code should be local to the class. Disadvantage is that now Response has a dependency on RequestContext (which is passed through its constructor).
* I added some overloaded factory methods called `Response` and `StaticFileResponse` that create the right response object based on the parameter types. Users can thus call e.g. `context.Response("moo").Send()`
* Changed some `Respond` methods so that they take literal strings and ints instead of implicitly converted `Response` objects, so that they are discoverable from the IDE.
* Removed the implicit conversions
* Result is that a user has the same options as before, but can type `context.` and a drop-down with all the different ways to create responses is shown by the IDE.
* Added some doc comments here and there, plus a simple readme with an example

No idea whether you're open to this at all. Curious to see what you think!