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

Error when API sets a cookie #12

Open
grounded042 opened this issue Jul 28, 2016 · 6 comments · May be fixed by #13
Open

Error when API sets a cookie #12

grounded042 opened this issue Jul 28, 2016 · 6 comments · May be fixed by #13
Labels

Comments

@grounded042
Copy link

Whenever my API responds with a header Set-Cookie, I get the error info: Hook handler stderr: panic: RPC client threw error gob: type not registered for interface: []interface {}

I have narrowed this down to the Set-Cookie header. If I name the header anything else, it doesn't give me that error, but when I name it Set-Cookie I always get that error.

@ddelnano
Copy link
Collaborator

Thank you for the error report, can you please post your hookfiles and I should have some time to dig into this tonight.

@grounded042
Copy link
Author

Here is the more complete detailed error it gives:

info: Hook handler stderr: panic(0x354580, 0xc82021a6e0)
        /usr/local/Cellar/go/1.6.2/libexec/src/runtime/panic.go:481 +0x3e6
github.com/snikch/goodman.(*Run).RunBeforeEachValidation(0xc82015c3a0, 0xc820220000)
        /Users/jcarl/gocode/src/github.com/snikch/goodman/runner.go:62 +0x1fd
github.com/snikch/goodman.(*Server).RunBeforeEachValidation(0xc82011dee8, 0xc820220000)
        /Users/jcarl/gocode/src/github.com/snikch/goodman/server.go:153 +0x93
github.com/snikch/goodman.(*Server).ProcessMessage(0xc82011dee8, 0xc820208600, 0x0, 0x0)
        /Users/jcarl/gocode/src/github.com/snikch/goodman/server.go:108 +0x761
github.com/snikch/goodman.(*Server).Run(0xc82011dee8, 0x0, 0x0)
        /Users/jcarl/gocode/src/github.com/snikch/goodman/server.go:70 +0x6ae
main.main()
        /Users/jcarl/gocode/src/github.com/snikch/goodman/cmd/goodman/main.go:60 +0x3fe

error: Hook handler '/Users/jcarl/gocode/bin/goodman' exited with status: 2
warn: Hook handling timed out.
error: Hook handler '/Users/jcarl/gocode/bin/goodman' exited with status: 2

Will post hookfiles in a sec.

@grounded042
Copy link
Author

I was able to replicate the issue with an example setup. Here is the example: https://github.com/grounded042/goodman-set-cookie. I did not add any hooks to show that it happens without writing any hooks but just by compiling the hooks and running dredd.

@ddelnano
Copy link
Collaborator

ddelnano commented Jul 29, 2016

@grounded042 so I am able to reproduce the issue and also am pretty confident I know why it is occurring. This line here will create a header like so

Headers:
  set-cookie: ["Test=Yo"]

Since goodman uses RPC to execute the hooks, the transactions are encoded / decoded via the gob package. It seems to be that when the above header structure is mixed with key value pairs like Content-Type: 123 it has problems.

I think the solution is to treat header values always like map[string][]string so I need to change how the json data sent from Dredd is unmarshaled so that the data type of the Headers is always the same type.

I am gonna be away this weekend but I will try to resolve this issue as soon as I can.

@grounded042
Copy link
Author

Sweet! Thanks for taking a look.

@ddelnano ddelnano added the bug label Jul 29, 2016
@ddelnano
Copy link
Collaborator

ddelnano commented Aug 2, 2016

@grounded042 a little update, I am struggling to reproduce this in a testing environment because I am trying to add a new cucumber / aruba test and since I am not a ruby guy I am having problems writing the test. Hoping to have something updated this week however.

@ddelnano ddelnano linked a pull request Aug 5, 2016 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants