// encodeResponse simply forwards the response Tr1d1um got from the XMiDT API
// TODO: What about if XMiDT cluster reports 500. There would be ambiguity
// about which machine is actually having the error (Tr1d1um or the Xmidt API)
// do we care to make that distinction?
encodeResponse simply forwards the response Tr1d1um got from the XMiDT API
TODO: What about if XMiDT cluster reports 500.
// encodeResponse simply forwards the response Tr1d1um got from the XMiDT API // TODO : What about if XMiDT cluster reports 500 . There would be ambiguity // about which machine is actually having the error ( Tr1d1um or the Xmidt API ) // do we care to make that distinction?
func encodeResponse(ctx context.Context, w http.ResponseWriter, response interface{}) (err error) {
	resp := response.(*transaction.XmidtResponse)
	if resp.Code == http.StatusOK {
		w.Header().Set("Content-Type", "application/json")
	} else {
		w.Header().Del("Content-Type")
	}
	w.Header().Set(transaction.HeaderWPATID, ctx.Value(transaction.ContextKeyRequestTID).(string))
	transaction.ForwardHeadersByPrefix("", resp.ForwardedHeaders, w.Header())
	w.WriteHeader(resp.Code)
	_, err = w.Write(resp.Body)
	return
}
func encodeResponse ( ctx context . Context , w http . ResponseWriter , response interface { } ) ( err error ) { resp := response . ( * transaction . XmidtResponse ) if resp . Code == http . StatusOK { w . Header ( ) . Set ( " " , " " ) } else { w . Header ( ) . Del ( " " ) } w . Header ( ) . Set ( transaction . HeaderWPATID , ctx . Value ( transaction . ContextKeyRequestTID ) . ( string ) ) transaction . ForwardHeadersByPrefix ( " " , resp . ForwardedHeaders , w . Header ( ) ) w . WriteHeader ( resp . Code ) _ , err = w . Write ( resp . Body ) return }
encodeResponse simply forwards the response Tr1d1um got from the XMiDT API
TODO: What about if XMiDT cluster reports 500.
encodeResponse simply forwards the response Tr1d1um got from the XMiDT API TODO : What about if XMiDT cluster reports 500 .