// WriteHeader writes hdr and prepares to accept the file's contents.
// WriteHeader calls Flush if it is not the first header.
// Calling after a Close will return ErrWriteAfterClose.
483879
func (tw *Writer) WriteHeader(hdr *Header) error {
	return tw.writeHeader(hdr, true)
}
1245767
func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error {
	if s.updateHeaderSent() || s.getState() == streamDone {
		return ErrIllegalHeaderWrite
	}
	s.hdrMu.Lock()
	if md.Len() > 0 {
		if s.header.Len() > 0 {
			s.header = metadata.Join(s.header, md)
		} else {
			s.header = md
		}
	}
	if err := t.writeHeaderLocked(s); err != nil {
		s.hdrMu.Unlock()
		return err
	}
	s.hdrMu.Unlock()
	return nil
}
1219909
func (h *Handler) WriteHeader(s int) {
	h.ResponseWriter.WriteHeader(s)
	h.responseData.status = s
}
1143229
func (r *RPCHeaderHandler) WriteHeader(w io.Writer, req []byte, writeAuth bool) error {
	var (
		token string
		err   error
		err2  error
	)
	binary.Write(w, byteOrder, RPCMagicNumber)
	if writeAuth {
		binary.Write(w, byteOrder, uint8(1))
		// get current host token
		var signer Signer = &delegateKeys
		token, err = AuthTokenNonBlocking()
		if err != nil {
			log.WithError(err).Debug("Unable to retrieve delegate token")
			// We may be an un-added master
			token, err2 = MasterToken()
			if err2 != nil {
				log.WithError(err2).Debug("Unable to retrieve master token")
				// Return the original error message
				return err
			}
			signer = &masterKeys
		}
		h := NewAuthHeaderWriterTo([]byte(token), req, signer)
		_, err = h.WriteTo(w)
	} else {
		binary.Write(w, byteOrder, uint8(0))
		WriteLengthAndBytes(req, w)
	}
	return err
}
747734
func writeNestedTarHeader(tw *tar.Writer, parts []string, existing map[string]struct{}, hdr tar.Header) error {
	for i := range parts {
		componentDir := path.Join(parts[:i+1]...)
		if _, ok := existing[componentDir]; ok {
			continue
		}
		existing[componentDir] = struct{}{}
		hdr.Name = componentDir
		if err := tw.WriteHeader(&hdr); err != nil {
			return err
		}
	}
	return nil
}
1167081
func (r *Response) WriteHeader(code int) {
	r.code = code
	r.rw.WriteHeader(code)
}
800562
func writeTo31Header(w io.Writer, id uint8, data []byte) error {
	if len(data) > 0 {
		if err := binary.Write(w, binary.LittleEndian, id); err != nil {
			return err
		}
		if err := binary.Write(w, binary.LittleEndian, uint16(len(data))); err != nil {
			return err
		}
		if err := binary.Write(w, binary.LittleEndian, data); err != nil {
			return err
		}
	}
	return nil
}
49902
func (this *statusResponseWriter) WriteHeader(code int) {
	this.code = code
	this.ResponseWriter.WriteHeader(code)
}
1263061
func writeHeaders(hdr http.Header, buf []byte, maxAge time.Duration, hash string) {
	hdr.Set("Content-Type", "image/x-icon")
	hdr.Set("Content-Length", strconv.Itoa(len(buf)))
	hdr.Set("Etag", hash)
	hdr.Set("Cache-Control", "public, max-age="+strconv.Itoa(int(maxAge.Seconds())))
}
189549
func (rw *responseWriter) WriteHeader(c int) {
	if rw.Written() {
		return
	}
	rw.status = c
	rw.w.WriteHeader(c)
}
392192
func (c *Call) WriteResponseHeader(k, v string) error {
	return (*encoding.Call)(c).WriteResponseHeader(k, v)
}
472548
func (a RenameAdapter) WriteHeader(hdr *tar.Header) error {
	if hdr.Name == a.Old {
		hdr.Name = a.New
	} else if strings.HasPrefix(hdr.Name, a.Old+"/") {
		hdr.Name = a.New + hdr.Name[len(a.Old):]
	}

	return a.Writer.WriteHeader(hdr)
}
235180
func (b *Block) fillHeader() {
	if b.LastCommitHash == nil {
		b.LastCommitHash = b.LastCommit.Hash()
	}
	if b.DataHash == nil {
		b.DataHash = b.Data.Hash()
	}
	if b.EvidenceHash == nil {
		b.EvidenceHash = b.Evidence.Hash()
	}
}
887526
func (c *cacheControlResponseWriter) WriteHeader(statusCode int) {
	c.statusCode = statusCode
	c.ResponseWriter.WriteHeader(statusCode)
}
1211298
func (r *recordResponseWriter) WriteHeader(i int) {
	r.statusCode = i
	if !r.headersLogged {
		writeHeaders(&r.headers, i, r.ResponseWriter.Header())
		r.headersLogged = true
	}
	r.ResponseWriter.WriteHeader(i)
}
74184
func (r *responseWriterWithStatus) WriteHeader(code int) {
	r.code = code
	r.ResponseWriter.WriteHeader(code)
}
1169244
func (r *ResponseData) WriteHeader(status int) {
	go IncrCounter([]string{"goa", "response", strconv.Itoa(status)}, 1.0)
	r.Status = status
	r.ResponseWriter.WriteHeader(status)
}