Skip to content

Commit

Permalink
services/friendbot: removed friendbot is disabled error messages that…
Browse files Browse the repository at this point in the history
… is dead code (#4059)
  • Loading branch information
leighmcculloch authored Nov 9, 2021
1 parent d582fae commit 30b2402
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions services/friendbot/internal/friendbot_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ func (handler *FriendbotHandler) Handle(w http.ResponseWriter, r *http.Request)

// doHandle is just a convenience method that returns the object to be rendered
func (handler *FriendbotHandler) doHandle(r *http.Request) (*horizon.Transaction, error) {
err := handler.checkEnabled()
if err != nil {
return nil, err
}

err = r.ParseForm()
err := r.ParseForm()
if err != nil {
p := problem.BadRequest
p.Detail = "Request parameters are not escaped or incorrectly formatted."
Expand All @@ -51,19 +46,6 @@ func (handler *FriendbotHandler) doHandle(r *http.Request) (*horizon.Transaction
return handler.Friendbot.Pay(address)
}

func (handler *FriendbotHandler) checkEnabled() error {
if handler.Friendbot != nil {
return nil
}

return &problem.P{
Type: "friendbot_disabled",
Title: "Friendbot is disabled",
Status: http.StatusForbidden,
Detail: "Friendbot is disabled on this network. Contact the server administrator if you believe this to be in error.",
}
}

func (handler *FriendbotHandler) loadAddress(r *http.Request) (string, error) {
address := r.Form.Get("addr")
unescaped, err := url.QueryUnescape(address)
Expand Down

0 comments on commit 30b2402

Please sign in to comment.