We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When calling Response.Exit(), code hangs.
Response.Exit()
Example for reproduction:
Set shouldExit to true, and the test hangs. Set shouldExit to false and the test does not hang.
shouldExit
true
false
package main import ( "errors" "fmt" "net/http" "testing" "github.com/Kong/go-pdk" "github.com/stretchr/testify/assert" k "github.com/Kong/go-pdk/test" ) type foo struct { shouldExit bool } func New() *foo { return &foo{ // manually change me to see both ways shouldExit: true, } } func (f *foo) Response(kong *pdk.PDK) { if f.shouldExit { fmt.Println("im trying to exit early") kong.Response.Exit(http.StatusInternalServerError, []byte(errors.New("exit").Error()), nil) } fmt.Println("im done") } func TestFoo(t *testing.T) { t.Parallel() env, err := k.New(t, k.Request{ Method: "POST", Url: "", Body: []byte("{}"), }) assert.NoError(t, err) env.DoHttps(New()) }
I will note that kong.Response.ExitStatus() does not hang.
kong.Response.ExitStatus()
The text was updated successfully, but these errors were encountered:
Fixed by #174
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
When calling
Response.Exit()
, code hangs.Example for reproduction:
Set
shouldExit
totrue
, and the test hangs.Set
shouldExit
tofalse
and the test does not hang.I will note that
kong.Response.ExitStatus()
does not hang.The text was updated successfully, but these errors were encountered: