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

Lowercase Struct Param Fields? #17

Open
xeoncross opened this issue Feb 3, 2018 · 2 comments
Open

Lowercase Struct Param Fields? #17

xeoncross opened this issue Feb 3, 2018 · 2 comments

Comments

@xeoncross
Copy link

xeoncross commented Feb 3, 2018

Currently Body/Form/Query fields must be capital to be public struct members.

"reflect: reflect.Value.SetString using value obtained using unexported field" -
gongular/parser.go:142

type InputHandler struct {
	Param struct {
		Name string
	}
	Query struct {
		Ref int
	}
	Form struct {
		Title   string `valid:"required"`
		Email   string
		Message string `valid:"required"`
	}
}

However, it would be nice if lowercase values could be used to conform to modern lowercase request param usage. I've looked through the source code and documentation and I don't see any mention of (my first guess) struct field tags Title string 'name:title' as an option.

How should I be handling this?

@mustafaakin
Copy link
Owner

Sure, it should be trivial. But instead of tags, should we match with case ignore?

@xeoncross
Copy link
Author

Well, that ignore case would be easiest.

I can say in over 10 years of multiple languages, API's, and platforms I've never, ever had a request where two params were named the same thing (in different cases) and contained different values.

HTTP POST /?bar=yes
BAR=no

Though that doesn't mean someone hasn't.

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

No branches or pull requests

2 participants