Closed jimydavis closed 9 months ago
I don't understand your point, sorry. Yes, validate
might be ill-named as it also sets the defaults, but why would you want to disable this behavior? The handler depends on all config fields to be set, so it is important that default values are set when no value is provided by the caller. In the end, this also benefits the user as it reduces the possibility of errors.
- UnroutedHandler should be slightly more primitive. User can always copy paste the code.
I disagree with both. UnroutedHandler should be the same as the routed Handler, except for the routing. Everything else should be the same. Also, requiring the user to duplicate internal code is not the preferred approach.
Thank you for the quick reply! I think it was mostly my confusion with the verb validate
as well as code that follows after the validate function inside NewUnroutedHandler. I was trying to figure out what was the separation. It is not an issue after I read your answer and I will close the question.