func handleGet()

in http.go [145:170]


func handleGet(ctx Context, w http.ResponseWriter, group *Group, key string) {
	var value []byte
	ttl, err := group.Get(ctx, key, AllocatingByteSliceSink(&value))
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}

	var ttlTimestamp *tspb.Timestamp = nil
	if ttl != nil {
		ttlTimestamp, err = ptypes.TimestampProto(*ttl)
		if err != nil {
			http.Error(w, err.Error(), http.StatusInternalServerError)
			return
		}
	}

	// Write the value to the response body as a proto message.
	body, err := proto.Marshal(&pb.GetResponse{Value: value, Ttl: ttlTimestamp})
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
		return
	}
	w.Header().Set("Content-Type", "application/x-protobuf")
	w.Write(body)
}