Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdu2009 committed Jul 10, 2019
1 parent 7f68137 commit 04b1cf5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
17 changes: 9 additions & 8 deletions xgin/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package xgin

import (
"io"
"net/http"

"github.com/gin-gonic/gin"
"github.com/nickxb/pkg/xgin/xrender"
Expand Down Expand Up @@ -44,14 +45,14 @@ func DataFromReader(code int, contentLength int64, contentType string, reader io
return r
}

//func Redirect(code int, location string, req *http.Request) xrender.Render {
// r := xrender.Redirect{}
// r.Code_ = -1
// r.Redirect.Code = code
// r.Location = location
// r.Request = req
// return r
//}
func Redirect(code int, location string, req *http.Request) xrender.Render {
r := xrender.Redirect{}
r.Code_ = -1
r.Redirect.Code = code
r.Location = location
r.Request = req
return r
}

func Data(code int, contentType string, data []byte) xrender.Render {
r := xrender.Data{}
Expand Down
6 changes: 5 additions & 1 deletion xgin/xrender/redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@ import "github.com/gin-gonic/gin/render"

type Redirect struct {
render.Redirect
HttpCode
Code_ int
}

func (r Redirect) Code() int {
return r.Code_
}

0 comments on commit 04b1cf5

Please sign in to comment.