SAVEPOINT

This commit is contained in:
2017-11-12 20:43:43 +00:00
parent 058a647205
commit 1ba0794058
3 changed files with 13 additions and 11 deletions

View File

@@ -1,7 +1,9 @@
package tuu
import (
"bytes"
"context"
"io"
"net/http"
"net/url"
@@ -68,9 +70,7 @@ func (d *DefaultContext) Value(key interface{}) interface{} {
}
func (d *DefaultContext) Render(status int, rr render.Renderer) error {
//p := plush.NewContext()
/*if rr != nil {
if rr != nil {
data := d.data
pp := map[string]string{}
for k, v := range d.params {
@@ -83,19 +83,19 @@ func (d *DefaultContext) Render(status int, rr render.Renderer) error {
err := rr.Render(bb, data)
if err != nil {
return HTTPError{Status: 500, Cause: errors.WithStack(err)}
return err
}
d.Response().Header().Set("Content-Type", rr.ContentType())
d.Response().WriteHeader(status)
_, err = io.Copy(d.Response(), bb)
if err != nil {
return HTTPError{Status: 500, Cause: errors.WithStack(err)}
return err
}
return nil
}
*/
d.Response().WriteHeader(status)
return nil
}

View File

@@ -4,8 +4,8 @@ import (
"net/http"
"testing"
"github.com/lukerodham/tuu"
"github.com/stretchr/testify/require"
"gitlab.com/lrodham/tuu"
)
func Test_Route_Creation(t *testing.T) {

View File

@@ -2,7 +2,9 @@ package examples
import (
"log"
"gitlab.com/lrodham/tuu"
"github.com/gin-gonic/gin/render"
"github.com/lukerodham/tuu"
)
func main() {
@@ -12,8 +14,8 @@ func main() {
ctx.Set("template_data", "some value")
return ctx.Render(200, render.HTML("template_name.html"))
})
})
router.POST("/login", func(ctx tuu.Context) error {
username := ctx.Param("username")
password := ctx.Param("password")
@@ -27,4 +29,4 @@ func main() {
if err := app.Serve(); err != nil {
panic(err)
}
}
}