~elementary-os/elementaryos/os-patch-aptly-xenial

« back to all changes in this revision

Viewing changes to src/github.com/smira/aptly/_vendor/src/github.com/gin-gonic/gin/deprecated.go

  • Committer: RabbitBot
  • Date: 2016-07-19 12:29:41 UTC
  • Revision ID: rabbitbot@elementary.io-20160719122941-z6gaxs7nzgmratry
Initial import, version 0.9.6-1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2014 Manu Martinez-Almeida.  All rights reserved.
 
2
// Use of this source code is governed by a MIT style
 
3
// license that can be found in the LICENSE file.
 
4
 
 
5
package gin
 
6
 
 
7
import (
 
8
        "github.com/gin-gonic/gin/binding"
 
9
        "net/http"
 
10
)
 
11
 
 
12
// DEPRECATED, use Bind() instead.
 
13
// Like ParseBody() but this method also writes a 400 error if the json is not valid.
 
14
func (c *Context) EnsureBody(item interface{}) bool {
 
15
        return c.Bind(item)
 
16
}
 
17
 
 
18
// DEPRECATED use bindings directly
 
19
// Parses the body content as a JSON input. It decodes the json payload into the struct specified as a pointer.
 
20
func (c *Context) ParseBody(item interface{}) error {
 
21
        return binding.JSON.Bind(c.Request, item)
 
22
}
 
23
 
 
24
// DEPRECATED use gin.Static() instead
 
25
// ServeFiles serves files from the given file system root.
 
26
// The path must end with "/*filepath", files are then served from the local
 
27
// path /defined/root/dir/*filepath.
 
28
// For example if root is "/etc" and *filepath is "passwd", the local file
 
29
// "/etc/passwd" would be served.
 
30
// Internally a http.FileServer is used, therefore http.NotFound is used instead
 
31
// of the Router's NotFound handler.
 
32
// To use the operating system's file system implementation,
 
33
// use http.Dir:
 
34
//     router.ServeFiles("/src/*filepath", http.Dir("/var/www"))
 
35
func (engine *Engine) ServeFiles(path string, root http.FileSystem) {
 
36
        engine.router.ServeFiles(path, root)
 
37
}
 
38
 
 
39
// DEPRECATED use gin.LoadHTMLGlob() or gin.LoadHTMLFiles() instead
 
40
func (engine *Engine) LoadHTMLTemplates(pattern string) {
 
41
        engine.LoadHTMLGlob(pattern)
 
42
}
 
43
 
 
44
// DEPRECATED. Use NoRoute() instead
 
45
func (engine *Engine) NotFound404(handlers ...HandlerFunc) {
 
46
        engine.NoRoute(handlers...)
 
47
}