This repository was archived by the owner on Apr 8, 2019. It is now read-only.
This repository was archived by the owner on Apr 8, 2019. It is now read-only.
Client, Request, Response #2
Open
Description
We need to design a standard struct/interface for client, request, response to use across all the operations, schema changes, updating documents etc. It is possible we do the converting directly and user don't need to call json.Unmarshal
directly
TODO
-
checkResponse
does not work for certain APIs because- they don't use status code to indicate error
- 404 returns html page
- schema management has its own error response format
Ref
net/http
- google cloud client https://github.com/GoogleCloudPlatform/google-cloud-go
- github client https://github.com/google/go-github
- when using
json.Decoder
extra call is needed to drain the body and reuse connection Drain Response.Body to enable TCP/TLS connection reuse (4x speedup) google/go-github#317 (does it still needed for newer golang version?)
- when using
- docker client https://github.com/moby/moby/tree/master/client
- elastic https://github.com/olivere/elastic
- https://github.com/kubernetes/client-go
- gocql https://github.com/gocql/gocql