Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix ModifyResponse call to context.Get #299

Closed
wants to merge 1 commit into from
Closed

fix ModifyResponse call to context.Get #299

wants to merge 1 commit into from

Conversation

bramhaghosh
Copy link
Member

context.Get does not return an error - it returns a value and an ok (like a map)
ModifyResponse was calling it incorrectly.

Fixes #298

@zema1
Copy link
Contributor

zema1 commented Aug 30, 2019

To be honest, I don't think this will fix #298. It's the nil ctx that cause the panic, which means like

var ctx *martian.Context
i, ok := ctx.Get("key")  // panic here
fmt.Print(i, ok)

@admtnnr
Copy link
Contributor

admtnnr commented Sep 7, 2019

@zema1 is correct and the line of code is WAI, even if it looks a little weird. You're right that Get returns a value and an ok, but the value that we put in the context on line 60 is an error.

@hueich
Copy link
Collaborator

hueich commented Sep 9, 2019

+1 to what @zema1 and @admtnnr said. The line martian.NewContext(res.Request) seems to return a null pointer in line 77. Somehow the stored Context* value in ctxs map is null for this request.

@bramhaghosh bramhaghosh closed this Jan 9, 2020
@bramhaghosh bramhaghosh deleted the viafix branch January 9, 2020 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

panic in context.go
4 participants