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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃┕ Fix: Unintended overwritten bind variables #2240

Merged
merged 2 commits into from Dec 1, 2022

Conversation

cwinters8
Copy link
Contributor

Description

Presently, if a bind value passed when calling c.Render has the same key as a default value passed in middleware using c.Bind, the default value overwrites the value set with c.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 with c.Bind is rendered.

This PR addresses the described issue of overwritten bind variables.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I tried to make my code as fast as possible with as few allocations as possible

@welcome
Copy link

welcome bot commented Nov 26, 2022

Thanks for opening this pull request! 馃帀 Please check out our contributing guidelines. If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

@ReneWerner87 ReneWerner87 merged commit f367916 into gofiber:master Dec 1, 2022
@welcome
Copy link

welcome bot commented Dec 1, 2022

Congrats on merging your first pull request! 馃帀 We here at Fiber are proud of you! If you need help or want to chat with us, join us on Discord https://gofiber.io/discord

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants