đ Bytes
The Bytes response is a very "low level" response.
Bytes writes the data parameter with the given status code to the http.ResponseWriter
The Content-Type header is set to nothing at all.
func ExampleStringGet(request there.Request) there.Response {
return there.String(status.OK, "Hello there")
}
When this handler gets called, the final rendered result will be
Hello there
func Bytes(code int, data []byte) Response {
return &bytesResponse{code: code, data: data}
}
type bytesResponse struct {
code int
data []byte
}
func (j bytesResponse) ServeHTTP(rw http.ResponseWriter, r *http.Request) {
_, err := rw.Write(j.data)
if err != nil {
log.Printf("bytesResponse: ServeHttp write failed: %v", err)
}
}