mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 17:42:14 +08:00
Merge branch 'master' into feature/run-fd
This commit is contained in:
commit
5d8b154588
10
README.md
10
README.md
@ -824,12 +824,12 @@ form.html
|
||||
<form action="/" method="POST">
|
||||
<p>Check some colors</p>
|
||||
<label for="red">Red</label>
|
||||
<input type="checkbox" name="colors[]" value="red" id="red" />
|
||||
<input type="checkbox" name="colors[]" value="red" id="red">
|
||||
<label for="green">Green</label>
|
||||
<input type="checkbox" name="colors[]" value="green" id="green" />
|
||||
<input type="checkbox" name="colors[]" value="green" id="green">
|
||||
<label for="blue">Blue</label>
|
||||
<input type="checkbox" name="colors[]" value="blue" id="blue" />
|
||||
<input type="submit" />
|
||||
<input type="checkbox" name="colors[]" value="blue" id="blue">
|
||||
<input type="submit">
|
||||
</form>
|
||||
```
|
||||
|
||||
@ -1160,7 +1160,7 @@ You may use custom delims
|
||||
```go
|
||||
r := gin.Default()
|
||||
r.Delims("{[{", "}]}")
|
||||
r.LoadHTMLGlob("/path/to/templates"))
|
||||
r.LoadHTMLGlob("/path/to/templates")
|
||||
```
|
||||
|
||||
#### Custom Template Funcs
|
||||
|
@ -24,9 +24,10 @@ const (
|
||||
ErrorTypePrivate ErrorType = 1 << 0
|
||||
// ErrorTypePublic indicates a public error.
|
||||
ErrorTypePublic ErrorType = 1 << 1
|
||||
// ErrorTypeAny indicates other any error.
|
||||
// ErrorTypeAny indicates any other error.
|
||||
ErrorTypeAny ErrorType = 1<<64 - 1
|
||||
ErrorTypeNu = 2
|
||||
// ErrorTypeNu indicates any other error.
|
||||
ErrorTypeNu = 2
|
||||
)
|
||||
|
||||
// Error represents a error's specification.
|
||||
@ -52,6 +53,7 @@ func (msg *Error) SetMeta(data interface{}) *Error {
|
||||
return msg
|
||||
}
|
||||
|
||||
// JSON creates a properly formated JSON
|
||||
func (msg *Error) JSON() interface{} {
|
||||
json := H{}
|
||||
if msg.Meta != nil {
|
||||
|
@ -79,19 +79,19 @@
|
||||
<label class="sr-only" for="chat-message">Message</label>
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{{.nick}}</div>
|
||||
<input type="text" name="message" id="chat-message" class="form-control" placeholder="a message" value="" />
|
||||
<input type="text" name="message" id="chat-message" class="form-control" placeholder="a message" value="">
|
||||
</div>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Send" />
|
||||
<input type="submit" class="btn btn-primary" value="Send">
|
||||
</form>
|
||||
{{else}}
|
||||
<form action="" method="get" class="form-inline">
|
||||
<legend>Join the SSE real-time chat</legend>
|
||||
<div class="form-group">
|
||||
<input value='' name="nick" id="nick" placeholder="Your Name" type="text" class="form-control" />
|
||||
<input value='' name="nick" id="nick" placeholder="Your Name" type="text" class="form-control">
|
||||
</div>
|
||||
<div class="form-group text-center">
|
||||
<input type="submit" class="btn btn-success btn-login-submit" value="Join" />
|
||||
<input type="submit" class="btn btn-success btn-login-submit" value="Join">
|
||||
</div>
|
||||
</form>
|
||||
{{end}}
|
||||
|
@ -35,9 +35,9 @@ var html = template.Must(template.New("chat_room").Parse(`
|
||||
<h1>Welcome to {{.roomid}} room</h1>
|
||||
<div id="messages"></div>
|
||||
<form id="myForm" action="/room/{{.roomid}}" method="post">
|
||||
User: <input id="user_form" name="user" value="{{.userid}}"></input>
|
||||
Message: <input id="message_form" name="message"></input>
|
||||
<input type="submit" value="Submit" />
|
||||
User: <input id="user_form" name="user" value="{{.userid}}">
|
||||
Message: <input id="message_form" name="message">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
4
mode.go
4
mode.go
@ -28,7 +28,7 @@ const (
|
||||
testCode
|
||||
)
|
||||
|
||||
// DefaultWriter is the default io.Writer used the Gin for debug output and
|
||||
// DefaultWriter is the default io.Writer used by Gin for debug output and
|
||||
// middleware output like Logger() or Recovery().
|
||||
// Note that both Logger and Recovery provides custom ways to configure their
|
||||
// output io.Writer.
|
||||
@ -36,6 +36,8 @@ const (
|
||||
// import "github.com/mattn/go-colorable"
|
||||
// gin.DefaultWriter = colorable.NewColorableStdout()
|
||||
var DefaultWriter io.Writer = os.Stdout
|
||||
|
||||
// DefaultErrorWriter is the default io.Writer used by Gin to debug errors
|
||||
var DefaultErrorWriter io.Writer = os.Stderr
|
||||
|
||||
var ginMode = debugCode
|
||||
|
Loading…
x
Reference in New Issue
Block a user