-
-
Notifications
You must be signed in to change notification settings - Fork 559
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
Design code and gen code case miss match for headers #1242
Comments
I took a look and the difference is that the code generator for the controller calls http.CanonicalHeaderKey where the code generator for the tests does not. So it seems the controller is "correct" and that the code should be |
I can test something but not 100% sure I understand what you're asking me to do or test. Guessing some with how I am testing my controller? |
Sorry my response wasn't super clear :) I mean if the generated test code was:
instead of:
Would that fix your issue? Just want to make sure the problem is not in the controller generated code but only in the test generated code. |
@raphael yes if I make that change in the testing code, my tests work pass! On a side note, I now understand what you were first asking/saying. Your point was that the casing in the controller code was right based on standards and the test code did not match the standards but it did match the design, which is why I was thinking the controller was where the problem is, but in fact it was by design that the controller did not match the design. Also makes sense that this was not reported before, but I am guessing less consumers of goa are using the testing code, so it went unnoticed where if the problem was in the controller I am sure would have been reported before. Thanks for the help. |
You got it, I'll work a fix soon. Thank you for confirming! |
This is now fixed, thanks for the detailed report! |
Running into an issue with Headers and case sensitivity and the generated code, meaning if I add something like the design below to to a resource the code in context.go that gen makes does not match cases everywhere making the ctx.ETag nil in the controller. Some places the gen code uses
ETag
and other isEtag
... if i change the design toEtag
then the gen code cases matchup. I noticed this problem when writing unit tests using the testing generated helpers. So the bug could be in that part of the code pipeline, but seems the be in the the Context constructor,headerETag := req.Header["Etag"]
the case for ETag does not match, resulting in the ETag field on the context object being nil.Design:
context.go:
testing.go:
The text was updated successfully, but these errors were encountered: