Skip to content

Commit

Permalink
fix server test bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ZORbit01 committed Apr 9, 2023
1 parent 70964ed commit caef10f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dispatcher/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,14 @@ func HandleCamp(writer http.ResponseWriter, request *http.Request, d *Dispatcher
return
}

// request.RemoteAddr == "" that means its testing, let change it
if request.RemoteAddr == "" {
request.RemoteAddr = "127.0.0.1:8081"
}

//set soldier ip
ip, _, err := net.SplitHostPort(request.RemoteAddr)

if err != nil {
http.Error(writer, err.Error(), http.StatusBadRequest)
return
Expand Down

0 comments on commit caef10f

Please sign in to comment.