bellycard/napa — pull request #167 by danielmackey (2014-12-09 22:36:27+00:00)
Title: Don't include error.reasons if none given

@bellycard/platform

When returning an error, the `reasons` key is always present, even if there is no data.

**current**
```
GET /foo/bar
HTTP/1.1 400 Bad Request
Server: nginx/1.6.2
Date: Tue, 09 Dec 2014 19:02:20 GMT
Content-Type: application/json
Content-Length: 86
Connection: close

{"error":{"code":"error_code","message":"Error message.","reasons":{}}}
```

This will check if there is any data present in the `reasons` attribute, and exclude it if there is none given.

**fixed**
```
GET /foo/bar
HTTP/1.1 400 Bad Request
Server: nginx/1.6.2
Date: Tue, 09 Dec 2014 19:02:20 GMT
Content-Type: application/json
Content-Length: 86
Connection: close

{"error":{"code":"error_code","message":"Error message."}}
```