Skip to content
This repository has been archived by the owner on Sep 21, 2022. It is now read-only.

Create new controller per request #68

Merged
merged 2 commits into from
Oct 25, 2016
Merged

Create new controller per request #68

merged 2 commits into from
Oct 25, 2016

Conversation

co11ter
Copy link
Contributor

@co11ter co11ter commented Oct 25, 2016

I don't write a tests! #67

Copy link
Owner

@gernest gernest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@co11ter don't bother with tests in this case. But just run the same test you ran to check if the crash still happen!

Have you done that?

@@ -213,8 +213,8 @@ func RegisterModels(models ...interface{}) {
}

// RegisterController registers a controller in the global utron App.
func RegisterController(ctrl Controller, middlewares ...interface{}) {
_ = baseApp.router.Add(ctrl, middlewares...)
func RegisterController(ctrlfn func() Controller, middlewares ...interface{}) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we improve this a little bit. This is going to break the API.

Maybe wrap the ctrl to a func that returns a new instance of ctrl everytime it is called?

This will keep everything working and fix the issue altogether.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how i can do it) What do you mean?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed it myself, based on your changes. 😄

@gernest gernest merged commit fb99f6f into gernest:master Oct 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants