Comments (7)
I was think about a Render() method in the Context struct.
So you could do this:
c.Render(200, render.YourRender, data)
what do you think?
from gin.
Then we could add in the Engine class something like: DefaultHTMLRender
so you do not have to call c.Render() and just use c.HTML()
from gin.
Check this out: 5ea7a92
What do you think?
from gin.
That looks great! A lot more flexible indeed π
from gin.
func (_ jsonRender) Render(w http.ResponseWriter, code int, data ...interface{}) error {
writeHeader(w, code, "application/xml")
Change string to "applicatoin/json" mime type.
from gin.
good catch! fixed! a1ff907
from gin.
Hi there -
Line 160 in a1ff907
SetHTMLTemplate
rather than SetHTTPTemplate
? Minor point.
Fixed in #70
from gin.
Related Issues (20)
- api docs inaccessible HOT 13
- Setting maxAge = -1 does not function as documented. HOT 1
- https://gin-gonic.com/ Invalid SSL certificate HOT 2
- HandlerName returns different output depending on go version HOT 3
- Redirect to another website - how to do HOT 3
- The protobuf version that this project relies on has security issues and it is recommended to upgrade.
- Socket file that gin listened are not removed when stopping gin process HOT 3
- For RouteInfo struct, add a list of handlers instead of the last for middleware usage
- Binding a non mandatory file parameter will directly result in an error message HOT 1
- ```ShouldBindBodyWith()``` will more types be supported in the future? HOT 2
- [Community Discussion] What's the status of Gin? HOT 6
- url parameters / path parameters /something(:id) HOT 7
- Is there any way to change the http request method? HOT 2
- Golang-Gin HOT 4
- How to use βAcceptedβ HOT 1
- Trailers sent twice if no body written HOT 2
- Pass variable in rout HOT 1
- Register tauri:// scheme (or allow custom schemes upstream?)
- please support get parms from Transfer-Encoding:compress-deflate
- unexpected EOF during install HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gin.