Skip to content

Commit

Permalink
add comment for method Redirect and Header in pkg/app/context.go
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-debug110 authored and li-jin-gou committed Jul 26, 2023
1 parent 3161f04 commit 8ce5436
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/app/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -769,10 +769,16 @@ func (ctx *RequestContext) Reset() {
ctx.conn = nil
}

// Redirect returns an HTTP redirect to the specific location.
// Note that this will not stop the current handler.
// in other words, if existed,the following code maybe execute and cause unexpected result
func (ctx *RequestContext) Redirect(statusCode int, uri []byte) {
ctx.redirect(uri, statusCode)
}

// Header is an intelligent shortcut for ctx.Response.Header.Set(key, value).
// It writes a header in the response.
// If value == "", this method removes the header `ctx.Response.Header.Del(key)`
func (ctx *RequestContext) Header(key, value string) {
if value == "" {
ctx.Response.Header.Del(key)
Expand Down

0 comments on commit 8ce5436

Please sign in to comment.