WriteString implements [io.StringWriter]. The data in str is written to rw.Body, if not nil.
(str string)
| 111 | // WriteString implements [io.StringWriter]. The data in str is written |
| 112 | // to rw.Body, if not nil. |
| 113 | func (rw *ResponseRecorder) WriteString(str string) (int, error) { |
| 114 | rw.writeHeader(nil, str) |
| 115 | if rw.Body != nil { |
| 116 | rw.Body.WriteString(str) |
| 117 | } |
| 118 | return len(str), nil |
| 119 | } |
| 120 | |
| 121 | func checkWriteHeaderCode(code int) { |
| 122 | // Issue 22880: require valid WriteHeader status codes. |