// WriteHeader satisfies the http.ResponseWriter interface and
// allows us to catch the status code
499731
func (w *ResponseWriter) WriteHeader(statusCode int) {
	w.status = statusCode
	w.ResponseWriter.WriteHeader(statusCode)
}
509260
func writeBlockHeader(w io.Writer, pver uint32, bh *BlockHeader) error {
	sec := uint32(bh.Timestamp.Unix())
	return writeElements(w, bh.Version, &bh.PrevBlock, &bh.MerkleRoot,
		sec, bh.Bits, bh.Nonce)
}
64271
func (m *scopedManager) Write(b []byte) (int, error) {
	if !m.wroteHeader {
		m.WriteHeader(http.StatusOK)
	}
	return m.ResponseWriter.Write(b)
}
111171
func writeError(w http.ResponseWriter, status int, err error) {
	w.WriteHeader(status)
	enc := json.NewEncoder(w)
	resp := baseapitypes.Error{
		Type: baseapitypes.InternalServerError,
		Err:  []string{err.Error()},
	}

	enc.Encode(resp)
}
966933
func (a ChmodAdapter) WriteHeader(hdr *tar.Header) error {
	if hdr.FileInfo().Mode()&os.ModeSymlink == 0 {
		newMode := hdr.Mode &^ 0777
		if hdr.FileInfo().IsDir() {
			newMode |= a.NewDirMode
		} else if hdr.FileInfo().Mode()&0010 != 0 { // S_IXUSR
			newMode |= a.NewExecFileMode
		} else {
			newMode |= a.NewFileMode
		}
		hdr.Mode = newMode
	}
	return a.Writer.WriteHeader(hdr)
}
397629
func (r *response) Write(header *Header, w io.WriterTo) (err error) {
	var buf bytes.Buffer

	// When the version is not configured properly, we will
	// use the version from the response header, to minimize
	// manual configuration.
	if header.Version == 0 {
		header.Version = r.header.Version
	}

	r.bufMu.Lock()
	defer r.bufMu.Unlock()
	defer r.buf.Reset()

	if w != nil {
		if _, err = w.WriteTo(&buf); err != nil {
			return
		}
	}

	header.Length = headerlen + uint16(buf.Len())
	_, err = header.WriteTo(&r.buf)
	if err != nil {
		return
	}

	_, err = buf.WriteTo(&r.buf)
	if err != nil {
		return
	}

	return r.conn.forceWrite(r.buf.Bytes())
}
395426
func writeHeader(hdr []byte, btype byte, enc, dec []byte) {
	hdr[0] = btype

	// 3 byte little endian length of encoded content
	length := uint32(len(enc)) + 4 // +4 for checksum
	hdr[1] = byte(length)
	hdr[2] = byte(length >> 8)
	hdr[3] = byte(length >> 16)

	// 4 byte little endian CRC32 checksum of decoded content
	checksum := maskChecksum(crc32.Checksum(dec, crcTable))
	hdr[4] = byte(checksum)
	hdr[5] = byte(checksum >> 8)
	hdr[6] = byte(checksum >> 16)
	hdr[7] = byte(checksum >> 24)
}
244651
func (g *Generator) writeHeader(w io.Writer) error {
	header := append([]byte("// "), []byte(g.header)...)
	header = append(header, []byte("\n\n")...)

	_, err := w.Write(header)
	return err
}
901214
func (lw *logWriter) WriteHeader(status int) {

	if lw.committed {
		log.Println("response already committed")
		return
	}

	lw.status = status
	lw.ResponseWriter.WriteHeader(status)
	lw.committed = true
}
1095036
func (s *sessionsResponseWriter) Write(buf []byte) (int, error) {
	if !s.wroteHeader {
		s.WriteHeader(http.StatusOK)
	}
	return s.ResponseWriter.Write(buf)
}
301212
func writeHeader(b *bytes.Buffer, header map[string][]string) {
	if len(header) == 0 {
		b.WriteString("   (no headers)\n")
		return
	}
	keys := make([]string, 0, len(header))
	// Alphabetize the headers
	for k := range header {
		keys = append(keys, k)
	}
	sort.Strings(keys)
	for _, k := range keys {
		// Redact the value of any Authorization header to prevent security information from persisting in logs
		value := interface{}("REDACTED")
		if !strings.EqualFold(k, "Authorization") {
			value = header[k]
		}
		fmt.Fprintf(b, "   %s: %+v\n", k, value)
	}
}
707715
func (s *rpcServer) writeHTTPResponseHeaders(req *http.Request, headers http.Header, code int, w io.Writer) error {
	_, err := io.WriteString(w, s.httpStatusLine(req, code))
	if err != nil {
		return err
	}

	err = headers.Write(w)
	if err != nil {
		return err
	}

	_, err = io.WriteString(w, "\r\n")
	return err
}
906623
func (rc *Response) SendWithHeader(status int, response *restful.Response) {
	if rc.Parent != nil {
		if resp, ok := rc.Parent.(SupportsEmptyResponse); ok {
			out := resp.EmptyResponse()
			if out != nil {
				response.WriteHeaderAndEntity(status, out)
				return
			}
		}

		response.WriteHeaderAndEntity(status, rc.Parent)
		return
	}

	response.WriteHeaderAndEntity(status, rc)
}
552590
func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error {
	return writeJSON(r, status, contentType, value)
}
1219909
func (h *Handler) WriteHeader(s int) {
	h.ResponseWriter.WriteHeader(s)
	h.responseData.status = s
}
483879
func (tw *Writer) WriteHeader(hdr *Header) error {
	return tw.writeHeader(hdr, true)
}
933440
func (r *Response) WriteHeader(httpStatus int) {
	r.statusCode = httpStatus
	r.ResponseWriter.WriteHeader(httpStatus)
}