soundcloud/harpoon — pull request #145 by stuartnelson3 (2014-12-08 14:23:52+00:00)
Title: [wip] small api refactor

__n.b.__ not sure if this is something that is worth adding or not, just started doing it as i was reading through `api.go`.

small refactor to clean up all the `http.Error(...)` responses. It expanded into returning a byte response as well.

the methods `handleList()` and `handleLog()` have eventsource handlers, and I'm not sure what would happen if I changed their method signatures to mirror the others and use the `handler()` function. doing so would cause the method return to write an empty byte slice to the connection. i.e.:

```go
// api.go:304
if isStreamAccept(r.Header.Get("Accept")) {
eventsource.Handler(func(_ string, enc *eventsource.Encoder, stop <-chan bool) {
a.streamLog(h, container.Logs(), enc, stop)
}).ServeHTTP(w, r)
return []byte(""), http.StatusOK, nil
}
```
so I did not include them in this wip. i don't think it would have any negative affects. i have an additional commit with those methods changed and the tests pass.