set status for the error response

This commit is contained in:
WeidiDeng 2024-10-17 15:53:26 +08:00
parent d395633749
commit 02b8640e44
No known key found for this signature in database
GPG key ID: 25F87CE1741EC7CD

View file

@ -209,6 +209,7 @@ func newErrorResponse(status int) *http.Response {
statusText := http.StatusText(status) statusText := http.StatusText(status)
resp := &http.Response{ resp := &http.Response{
Status: statusText, Status: statusText,
StatusCode: status,
Header: make(http.Header), Header: make(http.Header),
Body: io.NopCloser(strings.NewReader(statusText)), Body: io.NopCloser(strings.NewReader(statusText)),
ContentLength: int64(len(statusText)), ContentLength: int64(len(statusText)),