Skip to content

Commit

Permalink
code: return ok before set header
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdneilsfield committed Nov 26, 2023
1 parent 918a196 commit f2f1f0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ func LoadBalancerHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Failed to read response", http.StatusInternalServerError)
return
}
w.WriteHeader(http.StatusOK)
for k, v := range resp.Header {
w.Header()[k] = v
}
w.WriteHeader(http.StatusOK)
_, err = w.Write(body)
if err != nil {
// 处理写入错误
Expand Down

0 comments on commit f2f1f0b

Please sign in to comment.