chriso/klein.php — pull request #43 by nickl- (2012-05-11 16:12:18+00:00)
Title: Fixes to $response->json()

Thank you for this awesome hardcore minimalist one size fits all page router, knap gedaan!

Here is my small contribution to the amazing effort you've already done.
* Added the Content-Type: application/json to the $request->json() function to reflect the json content we are responding with.
* The quotes surrounding the $callback when doing the echo and passing a closure got php's knickers in a twist but by removing them it now works perfectly when doing something like;

```php
json($data, function ($json) {
return "

". $json ."

";
});
```

...not sure if this was the intended purpose or not?

PHP's complaint otherwise:
**Catchable fatal error:** Object of class Closure could not be converted to string in /[snip]/klein.php on line 474

Keep up the great work...