Merge pull request #33 from jasonrhansen/master
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Fix spelling and grammar errors in comments
authored by Manu Mtz.-Almeida · committed by Manu Mtz.-Almeida · parents f0282c8, fd30d28 · Browse files · 1 file·+16 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
1 file+16 added−16 removed
- other:+16 added−16 removed
Provenance
- Commit
5eb0e10- Tree
0079282- Author
Manu Mtz.-Almeida <manu.valladolid@gmail.com>- Committer
Manu Mtz.-Almeida <manu.valladolid@gmail.com>- Parent 1
f0282c8- Parent 2
fd30d28
1 file changed+16 added−16 removed
modified:gin.go+16 added-16 removed
21 unmodified lines22 HandlerFunc func(*Context)23 24 H map[string]interface{}25 26- // Used internally to collect a error ocurred during a http request.26+ // Used internally to collect errors that occurred during an http request.27 ErrorMsg struct {28 Err string `json:"error"`29 Meta interface{} `json:"meta"`30 }21 unmodified lines52 parent *RouterGroup53 engine *Engine54 }55 56- // Represents the web framework, it wrappers the blazing fast httprouter multiplexer and a list of global middlewares.56+ // Represents the web framework, it wraps the blazing fast httprouter multiplexer and a list of global middlewares.57 Engine struct {58 *RouterGroup59 handlers404 []HandlerFunc60 router *httprouter.Router90 unmodified lines151 func (group *RouterGroup) Use(middlewares ...HandlerFunc) {152 group.Handlers = append(group.Handlers, middlewares...)153 }154 155-// Greates a new router group. You should create add all the routes that share that have common middlwares or same path prefix.155+// Creates a new router group. You should add all the routes that have common middlwares or the same path prefix.156 // For example, all the routes that use a common middlware for authorization could be grouped.157 func (group *RouterGroup) Group(component string, handlers ...HandlerFunc) *RouterGroup {158 prefix := path.Join(group.prefix, component)159 return &RouterGroup{77 unmodified lines237 c.Writer.WriteHeader(code)238 c.index = AbortIndex239 }240 241-// Fail is the same than Abort plus an error message.241+// Fail is the same as Abort plus an error message.242 // Calling `context.Fail(500, err)` is equivalent to:243 // ```244 // context.Error("Operation aborted", err)245 // context.Abort(500)2 unmodified lines248 c.Error(err, "Operation aborted")249 c.Abort(code)250 }251 252-// Attachs an error to the current context. The error is pushed to a list of errors.253-// It's a gooc idea to call Error for each error ocurred during the resolution of a request.252+// Attaches an error to the current context. The error is pushed to a list of errors.253+// It's a good idea to call Error for each error that occurred during the resolution of a request.254 // A middleware can be used to collect all the errors and push them to a database together, print a log, or append it in the HTTP response.255 func (c *Context) Error(err error, meta interface{}) {256 c.Errors = append(c.Errors, ErrorMsg{257 Err: err.Error(),13 unmodified lines271 /************************************/272 /******** METADATA MANAGEMENT********/273 /************************************/274 275-// Sets a new pair key/value just for the specefied context.276-// It also lazy initializes the hashmap275+// Sets a new pair key/value just for the specified context.276+// It also lazy initializes the hashmap.277 func (c *Context) Set(key string, item interface{}) {278 if c.Keys == nil {279 c.Keys = make(map[string]interface{})280 }38 unmodified lines319 return err320 }321 }322 323-// Serializes the given struct as a JSON into the response body in a fast and efficient way.324-// It also sets the Content-Type as "application/json"323+// Serializes the given struct as JSON into the response body in a fast and efficient way.324+// It also sets the Content-Type as "application/json".325 func (c *Context) JSON(code int, obj interface{}) {326 c.Writer.Header().Set("Content-Type", "application/json")327 if code >= 0 {328 c.Writer.WriteHeader(code)4 unmodified lines333 http.Error(c.Writer, err.Error(), 500)334 }335 }336 337-// Serializes the given struct as a XML into the response body in a fast and efficient way.338-// It also sets the Content-Type as "application/xml"337+// Serializes the given struct as XML into the response body in a fast and efficient way.338+// It also sets the Content-Type as "application/xml".339 func (c *Context) XML(code int, obj interface{}) {340 c.Writer.Header().Set("Content-Type", "application/xml")341 if code >= 0 {342 c.Writer.WriteHeader(code)4 unmodified lines347 http.Error(c.Writer, err.Error(), 500)348 }349 }350 351-// Renders the HTTP template specified by his file name.352-// It also update the HTTP code and sets the Content-Type as "text/html".351+// Renders the HTTP template specified by its file name.352+// It also updates the HTTP code and sets the Content-Type as "text/html".353 // See http://golang.org/doc/articles/wiki/354 func (c *Context) HTML(code int, name string, data interface{}) {355 c.Writer.Header().Set("Content-Type", "text/html")356 if code >= 0 {7 unmodified lines364 http.Error(c.Writer, err.Error(), 500)365 }366 }367 368-// Writes the given string into the response body and sets the Content-Type to "text/plain"368+// Writes the given string into the response body and sets the Content-Type to "text/plain".369 func (c *Context) String(code int, msg string) {370 if code >= 0 {371 c.Writer.WriteHeader(code)372 }373 c.Writer.Header().Set("Content-Type", "text/plain")374 c.Writer.Write([]byte(msg))375 }376 377-// Writes some data into the body stream and updates the HTTP code377+// Writes some data into the body stream and updates the HTTP code.378 func (c *Context) Data(code int, data []byte) {379 c.Writer.WriteHeader(code)380 c.Writer.Write(data)381 }