Don't use pointers when you need them not!
This commit is contained in:
@@ -12,16 +12,16 @@ const (
|
||||
|
||||
// WriteErrorResponse prepares and writes a HTTP error
|
||||
// given a status code and an error message.
|
||||
func WriteErrorResponse(w *http.ResponseWriter, status int, msg string) {
|
||||
(*w).WriteHeader(status)
|
||||
(*w).Write([]byte(msg))
|
||||
func WriteErrorResponse(w http.ResponseWriter, status int, msg string) {
|
||||
w.WriteHeader(status)
|
||||
w.Write([]byte(msg))
|
||||
}
|
||||
|
||||
// WriteGasEstimateResponse prepares and writes an HTTP
|
||||
// response for transactions simulations.
|
||||
func WriteSimulationResponse(w *http.ResponseWriter, gas int64) {
|
||||
(*w).WriteHeader(http.StatusOK)
|
||||
(*w).Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
|
||||
func WriteSimulationResponse(w http.ResponseWriter, gas int64) {
|
||||
w.WriteHeader(http.StatusOK)
|
||||
w.Write([]byte(fmt.Sprintf(`{"gas_estimate":%v}`, gas)))
|
||||
}
|
||||
|
||||
// HasDryRunArg returns true if the request's URL query contains
|
||||
@@ -32,7 +32,7 @@ func HasDryRunArg(r *http.Request) bool {
|
||||
|
||||
// ParseFloat64OrReturnBadRequest converts s to a float64 value. It returns a default
|
||||
// value if the string is empty. Write
|
||||
func ParseFloat64OrReturnBadRequest(w *http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {
|
||||
func ParseFloat64OrReturnBadRequest(w http.ResponseWriter, s string, defaultIfEmpty float64) (n float64, ok bool) {
|
||||
if len(s) == 0 {
|
||||
return defaultIfEmpty, true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user