Send 直接发送内容,并终止请求
(status int, body string)
| 852 | |
| 853 | // Send 直接发送内容,并终止请求 |
| 854 | func (this *HTTPWriter) Send(status int, body string) { |
| 855 | this.req.ProcessResponseHeaders(this.Header(), status) |
| 856 | |
| 857 | // content-length |
| 858 | _, hasContentLength := this.Header()["Content-Length"] |
| 859 | if !hasContentLength { |
| 860 | this.Header()["Content-Length"] = []string{types.String(len(body))} |
| 861 | } |
| 862 | |
| 863 | this.WriteHeader(status) |
| 864 | _, _ = this.WriteString(body) |
| 865 | this.isFinished = true |
| 866 | } |
| 867 | |
| 868 | // SendFile 发送文件内容,并终止请求 |
| 869 | func (this *HTTPWriter) SendFile(status int, path string) (int64, error) { |
no test coverage detected