stretchr / goweb

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

Add Accept Equivalent for ?method= #48

Closed nelsam closed 10 years ago

nelsam commented 11 years ago

I finally got around to reading the documentation for goweb. Don't ask me why it's taken me this long.

I noticed the ?method=GET variable types in the documentation. I'm not planning to use it in my code, but it's kinda fun for testing stuff in the browser when I'm too lazy to alt+tab to my terminal and write out a curl request.

So I was wondering if we could get an equivalent for the Accept header. Seems like it would be nice for being able to read through XML vs JSON output and such.

matryer commented 10 years ago

You can always try the file extensions method,

something.json
something.xml
something.bson

For a full list, see https://github.com/stretchr/codecs

matryer commented 10 years ago

@nelsam does that work for you?

nelsam commented 10 years ago

I've been trying to figure out how I would get that to work in my system. It doesn't help my particular case without significant refactoring on my part, but then, I probably should be solving my particular case differently than I am right now.

I guess I'll close the issue for now, and after figuring out how I think my code should actually be working, I'll determine whether or not this is still an issue (and reopen if necessary).