Skip to content

Commit

Permalink
fix absent context for method without params
Browse files Browse the repository at this point in the history
  • Loading branch information
powerman committed Oct 13, 2016
1 parent 817f47b commit 81335e6
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions jsonrpc2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ func (c *serverCodec) ReadRequestBody(x interface{}) error {
if x == nil {
return nil
}
if x, ok := x.(WithContext); ok {
x.SetContext(c.ctx)
}
if c.req.Params == nil {
return nil
}
Expand All @@ -200,9 +203,6 @@ func (c *serverCodec) ReadRequestBody(x interface{}) error {
} else if err := json.Unmarshal(*c.req.Params, x); err != nil {
return NewError(errParams.Code, err.Error())
}
if x, ok := x.(WithContext); ok {
x.SetContext(c.ctx)
}
return nil
}

Expand Down

0 comments on commit 81335e6

Please sign in to comment.