Skip to content

Commit

Permalink
Switch Invocation Response Body to interface{}
Browse files Browse the repository at this point in the history
  • Loading branch information
driverpt committed Feb 2, 2023
1 parent 1843560 commit 38062db
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/event/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type Invocation struct {
Id string `json:"id"`
Body interface{} `json:"body"`
Timeout time.Time `json:"timeout"`
Response *string `json:"response"`
Response interface{} `json:"response"`
Error *RuntimeError `json:"error"`
ErrorType *string `json:"errorType"`
}
Expand Down Expand Up @@ -89,7 +89,12 @@ func (s Service) SendResponse(id string, body []byte) error {
return errors.New("invocation timeout")
}

b := string(body)
var b interface{}
err := json.Unmarshal([]byte(body), &b)
if err != nil {
return err
}

inv.Body = b
return nil
}
Expand Down

0 comments on commit 38062db

Please sign in to comment.