Thanks Pierre, that looks like a simple and quite clean implementation.
Although it's easier to use an iota for the numbering, does that open up
any issues with keeping the documentation up to date? I know it's easier
to program and extend, but it's also less obvious when codes change.
Is there a
>
> Since it is an HTTP Api, what about returning a standard HTTP status line,
> maybe with some non standard status code) and additional details about the
> error in the response body, JSON encoded?
That is exactly what we do. We return a HTTP status, but in addition, we
return a JSON encoded b
Thanks Roger. That is a really elegant solution.
On 26 December 2016 at 17:32, roger peppe wrote:
> On 26 December 2016 at 07:23, JohnGB wrote:
> > It *should* have a JSON body, but in this particular case I can't be sure
> > that it will, as I'm trying to log requests when there are errors, w
The code that I wrote to handle this is:
func writeZip(data []byte, filename string) error {
var fileGZ bytes.Buffer
zipper := gzip.NewWriter(&fileGZ)
_, err := zipper.Write(data)
if err != nil {
return err
}
// call the close explicitly
if err = zipper.Close(); err != nil {
return err
}
err =