Skip to content

Commit

Permalink
Merge pull request #43 from kaleido-io/fix-fromBlock
Browse files Browse the repository at this point in the history
Remove type hard-coding

Signed-off-by: Gabriel Indik <gabriel.indik@kaleido.io>
  • Loading branch information
gabriel-indik authored Aug 30, 2019
2 parents bb91c7b + 4bed783 commit 76820f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/kldcontracts/rest2eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ func (r *rest2eth) restHandler(res http.ResponseWriter, req *http.Request, param
}

func (r *rest2eth) fromBodyOrForm(req *http.Request, body map[string]interface{}, param string) string {
val := body["stream"]
val := body[param]
valType := reflect.TypeOf(val)
if valType != nil && valType.Kind() == reflect.String && len(val.(string)) > 0 {
return val.(string)
}
return req.FormValue("stream")
return req.FormValue(param)
}

func (r *rest2eth) subscribeEvent(res http.ResponseWriter, req *http.Request, addrStr string, abiEvent *abi.Event, body map[string]interface{}) {
Expand Down

0 comments on commit 76820f9

Please sign in to comment.