Skip to content

Commit

Permalink
优化异常处理
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowabi committed May 17, 2024
1 parent 9c54318 commit fcd5844
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions utils/response/responseHandle.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@ package net2

import (
"bytes"
"github.com/shadowabi/AutoDomain_rebuild/utils/Error"
"io"
"net/http"
)

func HandleResponse(resp *http.Response) (bodyString string) {
if resp == nil {
return ""
}
bodyBuf := new(bytes.Buffer)
_, err := io.Copy(bodyBuf, resp.Body)
Error.HandleError(err)
if err != nil {
return ""
}
bodyString = bodyBuf.String()
return bodyString
}
Expand Down

0 comments on commit fcd5844

Please sign in to comment.