google/go-safeweb

SetContext violates the context.Context contract

empijei opened this issue · 2 comments

In all APIs that rely on context there is no way for a callee to change the context of the caller.

Our IncomingRequest.SetContext method allows to do that. We should instead mimic the stdlib way and clone the request.

Alternatively we could explicitly pass context.Context as first parameter, but it would be quite a bit leap from the stlib api.

kele commented

I'm in favor of cloning as it's done in net/http.

kele commented

#321 switches SetContext to WithContext.