Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
sdk/middleware/sqgin: use the actual request context instead of gin's
Browse files Browse the repository at this point in the history
Gin's context wrongly implements `context.Context` and doesn't wrap the
underlying request context at all. Therefore, we need to use the actual request
context `c.Request.Context()` so that the agent can properly manage the request
context, but also to correctly propagate values stored in the context.
  • Loading branch information
Julio Guerra committed Sep 30, 2020
1 parent 018e38e commit a555f99
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sdk/middleware/sqgin/gin.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func middlewareHandler(agent protection_context.AgentFace, c *gingonic.Context)
requestReader := &requestReaderImpl{c: c}
responseWriter := &responseWriterImpl{c: c}

ctx, reqCtx, cancelHandlerContext := http_protection.NewRequestContext(c, agent, responseWriter, requestReader)
ctx, reqCtx, cancelHandlerContext := http_protection.NewRequestContext(c.Request.Context(), agent, responseWriter, requestReader)
if ctx == nil {
c.Next()
return
Expand Down

0 comments on commit a555f99

Please sign in to comment.