Skip to content

Commit 4f48c58

Browse files
committed
Treat the HTTP error message prefix as optional
1 parent 4563c50 commit 4f48c58

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

errors.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ type unsuccessfulHTTPResponse struct {
1212
}
1313

1414
func (u *unsuccessfulHTTPResponse) Error() string {
15-
return fmt.Sprint(u.messagePrefix, ", rcode = ", u.statusCode)
15+
if len(u.messagePrefix) > 0 {
16+
return fmt.Sprint(u.messagePrefix, ", rcode = ", u.statusCode)
17+
}
18+
return fmt.Sprint("rcode = ", u.statusCode)
1619
}
1720

1821
// HTTPResponseStatusCode extracts the HTTP status code for the response from Eureka that motivated

0 commit comments

Comments
 (0)