Add query functions and upgrade circleci to 2 #51
20
.circleci/config.yml
Normal file
20
.circleci/config.yml
Normal file
|
@ -0,0 +1,20 @@
|
|||
# Golang CircleCI 2.0 configuration file
|
||||
#
|
||||
# Check https://circleci.com/docs/2.0/language-go/ for more details
|
||||
version: 2
|
||||
jobs:
|
||||
build:
|
||||
docker:
|
||||
# specify the version
|
||||
- image: circleci/golang:1.10
|
||||
|
||||
working_directory: /go/src/github.com/lunny/tango
|
||||
steps:
|
||||
- checkout
|
||||
|
||||
- run: go get -t -d -v ./...
|
||||
- run: GO111MODULE=off go build -v
|
||||
- run: GO111MODULE=on go build -v
|
||||
- run: go test -v -race -coverprofile=coverage.txt -covermode=atomic
|
||||
|
||||
- run: bash <(curl -s https://codecov.io/bash)
|
12
circle.yml
12
circle.yml
|
@ -1,12 +0,0 @@
|
|||
dependencies:
|
||||
override:
|
||||
# './...' is a relative pattern which means all subdirectories
|
||||
- go get -t -d -v ./...
|
||||
- go build -v
|
||||
|
||||
test:
|
||||
override:
|
||||
# './...' is a relative pattern which means all subdirectories
|
||||
- go test -v -race -coverprofile=coverage.txt -covermode=atomic
|
||||
post:
|
||||
- bash <(curl -s https://codecov.io/bash)
|
|
@ -82,12 +82,17 @@ func (ctx *Context) Cookies() Cookies {
|
|||
return (*cookies)(ctx)
|
||||
}
|
||||
|
||||
// Forms returns the query names and values
|
||||
// Forms returns the query/body names and values
|
||||
func (ctx *Context) Forms() *Forms {
|
||||
ctx.req.ParseForm()
|
||||
return (*Forms)(ctx.req)
|
||||
}
|
||||
|
||||
// Queries returns the query names and values
|
||||
func (ctx *Context) Queries() *Queries {
|
||||
return (*Queries)(ctx.req)
|
||||
}
|
||||
|
||||
// Route returns route
|
||||
func (ctx *Context) Route() *Route {
|
||||
ctx.newAction()
|
||||
|
|
8
error.go
8
error.go
|
@ -83,3 +83,11 @@ type ErrorWithCode interface {
|
|||
error
|
||||
ErrorCode() int
|
||||
}
|
||||
|
||||
type ErrorKeyIsNotExist struct {
|
||||
Key string
|
||||
}
|
||||
|
||||
func (e ErrorKeyIsNotExist) Error() string {
|
||||
return fmt.Sprintf("Key %s is not exist", e.Key)
|
||||
}
|
||||
|
|
4
form.go
4
form.go
|
@ -1,3 +1,7 @@
|
|||
// Copyright 2016 The Tango Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package tango
|
||||
|
||||
import (
|
||||
|
|
12
form_test.go
12
form_test.go
|
@ -1,3 +1,7 @@
|
|||
// Copyright 2016 The Tango Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package tango
|
||||
|
||||
import (
|
||||
|
@ -5,6 +9,7 @@ import (
|
|||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
@ -40,7 +45,7 @@ type Form2Action struct {
|
|||
Ctx
|
||||
}
|
||||
|
||||
func (a *Form2Action) Get() string {
|
||||
func (a *Form2Action) Post() string {
|
||||
v, _ := a.Forms().Int32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
@ -51,12 +56,13 @@ func TestForm2(t *testing.T) {
|
|||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Form2Action))
|
||||
o.Post("/", new(Form2Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
req, err := http.NewRequest("POST", "http://localhost:8000", strings.NewReader("test=1"))
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
|
|
6
go.mod
Normal file
6
go.mod
Normal file
|
@ -0,0 +1,6 @@
|
|||
module github.com/lunny/tango
|
||||
|
||||
require (
|
||||
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de
|
||||
github.com/mattn/go-sqlite3 v1.10.0 // indirect
|
||||
)
|
4
go.sum
Normal file
4
go.sum
Normal file
|
@ -0,0 +1,4 @@
|
|||
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de h1:nyxwRdWHAVxpFcDThedEgQ07DbcRc5xgNObtbTp76fk=
|
||||
github.com/lunny/log v0.0.0-20160921050905-7887c61bf0de/go.mod h1:3q8WtuPQsoRbatJuy3nvq/hRSvuBJrHHr+ybPPiNvHQ=
|
||||
github.com/mattn/go-sqlite3 v1.10.0 h1:jbhqpg7tQe4SupckyijYiy0mJJ/pRyHvXf7JdWK860o=
|
||||
github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
|
353
query.go
Normal file
353
query.go
Normal file
|
@ -0,0 +1,353 @@
|
|||
// Copyright 2019 The Tango Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package tango
|
||||
|
||||
import (
|
||||
"html/template"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// Queries a new enhancement of http.Request
|
||||
type Queries http.Request
|
||||
|
||||
var _ Set = &Queries{}
|
||||
|
||||
// Values returns http.Request values
|
||||
func (f *Queries) Values() url.Values {
|
||||
return (*http.Request)(f).URL.Query()
|
||||
}
|
||||
|
||||
// String returns request form as string
|
||||
func (f *Queries) String(key string) (string, error) {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
return v[0], nil
|
||||
}
|
||||
return "", ErrorKeyIsNotExist{key}
|
||||
}
|
||||
|
||||
// Strings returns request form as strings
|
||||
func (f *Queries) Strings(key string) ([]string, error) {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
return v, nil
|
||||
}
|
||||
return nil, ErrorKeyIsNotExist{key}
|
||||
}
|
||||
|
||||
// Escape returns request form as escaped string
|
||||
func (f *Queries) Escape(key string) (string, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return template.HTMLEscapeString(s), nil
|
||||
}
|
||||
|
||||
// Int returns request form as int
|
||||
func (f *Queries) Int(key string) (int, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return strconv.Atoi(s)
|
||||
}
|
||||
|
||||
// Int32 returns request form as int32
|
||||
func (f *Queries) Int32(key string) (int32, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v, err := strconv.ParseInt(s, 10, 32)
|
||||
return int32(v), err
|
||||
}
|
||||
|
||||
// Int64 returns request form as int64
|
||||
func (f *Queries) Int64(key string) (int64, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v, err := strconv.ParseInt(s, 10, 64)
|
||||
return v, err
|
||||
}
|
||||
|
||||
// Uint returns request form as uint
|
||||
func (f *Queries) Uint(key string) (uint, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v, err := strconv.ParseUint(s, 10, 64)
|
||||
return uint(v), err
|
||||
}
|
||||
|
||||
// Uint32 returns request form as uint32
|
||||
func (f *Queries) Uint32(key string) (uint32, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v, err := strconv.ParseUint(s, 10, 32)
|
||||
return uint32(v), err
|
||||
}
|
||||
|
||||
// Uint64 returns request form as uint64
|
||||
func (f *Queries) Uint64(key string) (uint64, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return strconv.ParseUint(s, 10, 64)
|
||||
}
|
||||
|
||||
// Bool returns request form as bool
|
||||
func (f *Queries) Bool(key string) (bool, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return strconv.ParseBool(s)
|
||||
}
|
||||
|
||||
// Float32 returns request form as float32
|
||||
func (f *Queries) Float32(key string) (float32, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
v, err := strconv.ParseFloat(s, 64)
|
||||
return float32(v), err
|
||||
}
|
||||
|
||||
// Float64 returns request form as float64
|
||||
func (f *Queries) Float64(key string) (float64, error) {
|
||||
s, err := f.String(key)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return strconv.ParseFloat(s, 64)
|
||||
}
|
||||
|
||||
// MustString returns request form as string with default
|
||||
func (f *Queries) MustString(key string, defaults ...string) string {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
return v[0]
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MustStrings returns request form as strings with default
|
||||
func (f *Queries) MustStrings(key string, defaults ...[]string) []string {
|
||||
(*http.Request)(f).ParseMultipartForm(32 << 20)
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
return v
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return []string{}
|
||||
}
|
||||
|
||||
// MustEscape returns request form as escaped string with default
|
||||
func (f *Queries) MustEscape(key string, defaults ...string) string {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
return template.HTMLEscapeString(v[0])
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MustInt returns request form as int with default
|
||||
func (f *Queries) MustInt(key string, defaults ...int) int {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.Atoi(v[0])
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustInt32 returns request form as int32 with default
|
||||
func (f *Queries) MustInt32(key string, defaults ...int32) int32 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseInt(v[0], 10, 32)
|
||||
if err == nil {
|
||||
return int32(i)
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustInt64 returns request form as int64 with default
|
||||
func (f *Queries) MustInt64(key string, defaults ...int64) int64 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseInt(v[0], 10, 64)
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustUint returns request form as uint with default
|
||||
func (f *Queries) MustUint(key string, defaults ...uint) uint {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseUint(v[0], 10, 64)
|
||||
if err == nil {
|
||||
return uint(i)
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustUint32 returns request form as uint32 with default
|
||||
func (f *Queries) MustUint32(key string, defaults ...uint32) uint32 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseUint(v[0], 10, 32)
|
||||
if err == nil {
|
||||
return uint32(i)
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustUint64 returns request form as uint64 with default
|
||||
func (f *Queries) MustUint64(key string, defaults ...uint64) uint64 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseUint(v[0], 10, 64)
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustFloat32 returns request form as float32 with default
|
||||
func (f *Queries) MustFloat32(key string, defaults ...float32) float32 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseFloat(v[0], 32)
|
||||
if err == nil {
|
||||
return float32(i)
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustFloat64 returns request form as float64 with default
|
||||
func (f *Queries) MustFloat64(key string, defaults ...float64) float64 {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseFloat(v[0], 64)
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
// MustBool returns request form as bool with default
|
||||
func (f *Queries) MustBool(key string, defaults ...bool) bool {
|
||||
if v, ok := f.Values()[key]; ok {
|
||||
i, err := strconv.ParseBool(v[0])
|
||||
if err == nil {
|
||||
return i
|
||||
}
|
||||
}
|
||||
if len(defaults) > 0 {
|
||||
return defaults[0]
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Query returns request form as string with default
|
||||
func (ctx *Context) Query(key string, defaults ...string) string {
|
||||
return (*Queries)(ctx.req).MustString(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryStrings returns request form as strings with default
|
||||
func (ctx *Context) QueryStrings(key string, defaults ...[]string) []string {
|
||||
return (*Queries)(ctx.req).MustStrings(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryEscape returns request form as escaped string with default
|
||||
func (ctx *Context) QueryEscape(key string, defaults ...string) string {
|
||||
return (*Queries)(ctx.req).MustEscape(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryInt returns request form as int with default
|
||||
func (ctx *Context) QueryInt(key string, defaults ...int) int {
|
||||
return (*Queries)(ctx.req).MustInt(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryInt32 returns request form as int32 with default
|
||||
func (ctx *Context) QueryInt32(key string, defaults ...int32) int32 {
|
||||
return (*Queries)(ctx.req).MustInt32(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryInt64 returns request form as int64 with default
|
||||
func (ctx *Context) QueryInt64(key string, defaults ...int64) int64 {
|
||||
return (*Queries)(ctx.req).MustInt64(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryUint returns request form as uint with default
|
||||
func (ctx *Context) QueryUint(key string, defaults ...uint) uint {
|
||||
return (*Queries)(ctx.req).MustUint(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryUint32 returns request form as uint32 with default
|
||||
func (ctx *Context) QueryUint32(key string, defaults ...uint32) uint32 {
|
||||
return (*Queries)(ctx.req).MustUint32(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryUint64 returns request form as uint64 with default
|
||||
func (ctx *Context) QueryUint64(key string, defaults ...uint64) uint64 {
|
||||
return (*Queries)(ctx.req).MustUint64(key, defaults...)
|
||||
}
|
||||
|
||||
// QueryFloat32 returns request form as float32 with default
|
||||
func (ctx *Context) QueryFloat32(key string, defaults ...float32) float32 {
|
||||
return (*Queries)(ctx.req).MustFloat32(key, defaults...)
|
||||
}
|
||||
|
||||
// FormFloat64 returns request form as float64 with default
|
||||
func (ctx *Context) QueryFloat64(key string, defaults ...float64) float64 {
|
||||
return (*Queries)(ctx.req).MustFloat64(key, defaults...)
|
||||
}
|
||||
|
||||
// FormBool returns request form as bool with default
|
||||
func (ctx *Context) QueryBool(key string, defaults ...bool) bool {
|
||||
return (*Queries)(ctx.req).MustBool(key, defaults...)
|
||||
}
|
853
query_test.go
Normal file
853
query_test.go
Normal file
|
@ -0,0 +1,853 @@
|
|||
// Copyright 2019 The Tango Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package tango
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"testing"
|
||||
)
|
||||
|
||||
type Query1Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query1Action) Get() string {
|
||||
v, _ := a.Queries().Int("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery1(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query1Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query2Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query2Action) Get() string {
|
||||
v, _ := a.Queries().Int32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery2(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query2Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query3Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query3Action) Get() string {
|
||||
v, _ := a.Queries().Int64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery3(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query3Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query4Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query4Action) Get() string {
|
||||
v, _ := a.Queries().Uint("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery4(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query4Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query5Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query5Action) Get() string {
|
||||
v, _ := a.Queries().Uint32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery5(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query5Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query6Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query6Action) Get() string {
|
||||
v, _ := a.Queries().Uint64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery6(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query6Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query7Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query7Action) Get() string {
|
||||
v, _ := a.Queries().Float32("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery7(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query7Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query8Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query8Action) Get() string {
|
||||
v, _ := a.Queries().Float64("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery8(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query8Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query9Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query9Action) Get() string {
|
||||
v, _ := a.Queries().Bool("test")
|
||||
return fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
func TestQuery9(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query9Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "true")
|
||||
}
|
||||
|
||||
type Query10Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query10Action) Get() string {
|
||||
v, _ := a.Queries().String("test")
|
||||
return fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
func TestQuery10(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query10Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query11Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query11Action) Get() string {
|
||||
v := a.Queries().MustInt("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery11(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query11Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query12Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query12Action) Get() string {
|
||||
v := a.Queries().MustInt32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery12(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query12Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query13Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query13Action) Get() string {
|
||||
v := a.Queries().MustInt64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery13(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query13Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query14Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query14Action) Get() string {
|
||||
v := a.Queries().MustUint("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery14(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query14Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query15Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query15Action) Get() string {
|
||||
v := a.Queries().MustUint32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery15(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query15Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query16Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query16Action) Get() string {
|
||||
v := a.Queries().MustUint64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery16(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query16Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query17Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query17Action) Get() string {
|
||||
v := a.Queries().MustFloat32("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery17(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query17Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query18Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query18Action) Get() string {
|
||||
v := a.Queries().MustFloat64("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery18(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query18Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query19Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query19Action) Get() string {
|
||||
v := a.Queries().MustBool("test")
|
||||
return fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
func TestQuery19(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query19Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "true")
|
||||
}
|
||||
|
||||
type Query20Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query20Action) Get() string {
|
||||
v := a.Queries().MustString("test")
|
||||
return fmt.Sprintf("%s", v)
|
||||
}
|
||||
|
||||
func TestQuery20(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query20Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query21Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query21Action) Get() string {
|
||||
v := a.QueryInt("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery21(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query21Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query22Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query22Action) Get() string {
|
||||
v := a.QueryInt32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery22(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query22Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query23Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query23Action) Get() string {
|
||||
v := a.QueryInt64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery23(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query23Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query24Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query24Action) Get() string {
|
||||
v := a.QueryUint("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery24(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query24Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query25Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query25Action) Get() string {
|
||||
v := a.QueryUint32("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery25(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query25Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query26Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query26Action) Get() string {
|
||||
v := a.QueryUint64("test")
|
||||
return fmt.Sprintf("%d", v)
|
||||
}
|
||||
|
||||
func TestQuery26(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query26Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
||||
|
||||
type Query27Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query27Action) Get() string {
|
||||
v := a.QueryFloat32("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery27(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query27Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query28Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query28Action) Get() string {
|
||||
v := a.QueryFloat64("test")
|
||||
return fmt.Sprintf("%.2f", v)
|
||||
}
|
||||
|
||||
func TestQuery28(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query28Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1.00")
|
||||
}
|
||||
|
||||
type Query29Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query29Action) Get() string {
|
||||
v := a.QueryBool("test")
|
||||
return fmt.Sprintf("%v", v)
|
||||
}
|
||||
|
||||
func TestQuery29(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query29Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "true")
|
||||
}
|
||||
|
||||
type Query30Action struct {
|
||||
Ctx
|
||||
}
|
||||
|
||||
func (a *Query30Action) Get() string {
|
||||
v := a.Query("test")
|
||||
return fmt.Sprintf("%s", v)
|
||||
}
|
||||
|
||||
func TestQuery30(t *testing.T) {
|
||||
buff := bytes.NewBufferString("")
|
||||
recorder := httptest.NewRecorder()
|
||||
recorder.Body = buff
|
||||
|
||||
o := Classic()
|
||||
o.Get("/", new(Query30Action))
|
||||
|
||||
req, err := http.NewRequest("GET", "http://localhost:8000/?test=1", nil)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
||||
o.ServeHTTP(recorder, req)
|
||||
expect(t, recorder.Code, http.StatusOK)
|
||||
refute(t, len(buff.String()), 0)
|
||||
expect(t, buff.String(), "1")
|
||||
}
|
Loading…
Reference in New Issue
Block a user