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

docs: fix gin html status code overwrite and provide fallback renderer #550

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

Foggyman
Copy link
Contributor

Refactoring to better integrate with gin.HTML function (allow different http status code) and optionally add fallback html renderer to gin HTMLRender if no temp component is provided

…nt http status code) and optionally add fallback html renderer to gin HTMLRender if no temp component is provided
@joerdav joerdav changed the title Issue #545: refactoring gin integration example docs: fix gin html status code overwrite and provide fallback renderer Feb 26, 2024
@joerdav joerdav merged commit 5d4b87f into a-h:main Feb 26, 2024
4 checks passed
engine.HTMLRender = gintemplrenderer.Default
engine.LoadHTMLFiles("./home.html")

//engine.HTMLRender = gintemplrenderer.Default
Copy link
Owner

Choose a reason for hiding this comment

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

This seems like it's been left behind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Default is the old (retrocompatible) way if you do not want to provide a fallback renderer

Comment on lines +16 to +17
ginHtmlRenderer := engine.HTMLRender
engine.HTMLRender = &gintemplrenderer.HTMLTemplRenderer{FallbackHtmlRenderer: ginHtmlRenderer}
Copy link
Owner

Choose a reason for hiding this comment

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

This doesn't feel right. I don't see why the variable exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the variable can be removed indeed, it was to make the code a little more readable so that user can understand that here we are setting a fallback to gin default html renderer in case we do not pass a templ

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

Successfully merging this pull request may close these issues.

None yet

4 participants