code: func StreamObject(statusCode int, gv schema.GroupVersion, s runtime.NegotiatedSerializer, stream rest.ResourceStreamer, w http.ResponseWriter, req *http.Request) {
  	out, flush, contentType, err := stream.InputStream(req.Context(), gv.String(), req.Header.Get("Accept"))
  	if err != nil {
  		ErrorNegotiated(err, s, gv, w, req)
  		return
  	}
  	if out == nil {
  		// No output provided - return StatusNoContent
  		w.WriteHeader(http.StatusNoContent)
  		return
  	}
  	defer out.Close()
  
  	if wsstream.IsWebSocketRequest(req) {
  		r := wsstream.NewReader(out, true, wsstream.NewDefaultReaderProtocols())
  		if err := r.Copy(w, req); err != nil {
  			utilruntime.HandleError(fmt.Errorf("error encountered while streaming results via websocket: %v", err))
  		}
  		return
  	}
  
  	if len(contentType) == 0 {
  		contentType = "application/octet-stream"
  	}
  	w.Header().Set("Content-Type", contentType)
  	w.WriteHeader(statusCode)
  	// Flush headers, if possible
  	if flusher, ok := w.(http.Flusher); ok {
  		flusher.Flush()
  	}
  	writer := w.(io.Writer)
  	if flush {
  		writer = flushwriter.Wrap(w)
  	}
  	io.Copy(writer, out)
  }
docs: // StreamObject performs input stream negotiation from a ResourceStreamer and writes that to the response.
  // If the client requests a websocket upgrade, negotiate for a websocket reader protocol (because many
  // browser clients cannot easily handle binary streaming protocols).