stretchr / goweb

A lightweight RESTful web framework for Go
632 stars 61 forks source link

Added options for enveloping data and the corresponding test #65

Closed pengux closed 10 years ago

pengux commented 10 years ago

Resolve issue #63

matryer commented 10 years ago

LGTM - @tylerb can you review and merge if you're happy. Then we need to document this somewhere.

pengux commented 10 years ago

I found an issue with the enveloping options when the data is an array and ?envelop=false. This statement will gives an error:

sro = data.(map[string]interface{})

because the concrete type of data is []interface{}

My fix was to refactor the transformer's interfaces and methods to accept and return interface{} so that no type assertment is necessary. I've prepared a pull request for it which passed all the test, what do you guys think?