🩹 Fix: Unintended overwritten bind variables #2240
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Presently, if a bind value passed when calling
c.Render
has the same key as a default value passed in middleware usingc.Bind
, the default value overwrites the value set withc.Render
. Here is a small demonstration of the behavior. If you run that program, you will see that instead of the expected "Home" value being rendered in the h1 tag, the "default" value that was set withc.Bind
is rendered.This PR addresses the described issue of overwritten bind variables.
Type of change
I indicated "Bug fix" here as I have made a change that seems to be non-breaking on the surface, because it changes an unintended behavior to the intended behavior. However, I have seen cases in the past where changes like this actually end up breaking someone's project because they are depending on the existing (incorrect) behavior. Not sure if this is a concern here or not?
Checklist: