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

Don't serialize MVC return nil #1273

Closed
lightglitch opened this issue Jun 7, 2019 · 4 comments
Closed

Don't serialize MVC return nil #1273

lightglitch opened this issue Jun 7, 2019 · 4 comments

Comments

@lightglitch
Copy link

func (c *Controller) Get() *iris.Map {
return nil
}

Should be a way to not serialize nil as null, because sometimes we don't want to write anything to the output.

@kataras
Copy link
Owner

kataras commented Jun 14, 2019

A note:

@liguoqinjim you don't have to use * pointer in iris.Map it's just a map[string]interface{}.

I understand, however, it should be optional so I will introduce an optional mvc/hero configuration for the upcoming v11.2.0 which you will be able pass to declare "rules", it will be useful for any future request as well, sounds good?

UPDATE: Oh, that's a bug, the response shouldn't be send as "null" if the *iris.Map itself is nil, fixing it as we speak!

@kataras
Copy link
Owner

kataras commented Jun 14, 2019

Fixed with 56754d7 thanks for the report @lightglitch !

@lightglitch
Copy link
Author

Thx

@kataras
Copy link
Owner

kataras commented Jun 14, 2019

You're welcome, community and support are the two most important things for a project like this.

github-actions bot pushed a commit to goproxies/github.com-kataras-iris that referenced this issue Jul 27, 2020
Former-commit-id: 2b48b9b912e9eb8f5f2c6d413907dbfdae857e08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants