Blame view

cmd/httpserver/http_test.go 420 Bytes
0e5d52de   zhangqijia   reactor: 重构底层框架1.0
1
  package main
62d5d847   zhangqijia   http服务只用写actionSt...
2
3
4
  
  import (
  	"github.com/gin-gonic/gin"
0e5d52de   zhangqijia   reactor: 重构底层框架1.0
5
  	"pro2d/common/components"
62d5d847   zhangqijia   http服务只用写actionSt...
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  	"testing"
  )
  
  type HttpAction struct {
  }
  
  func (h *HttpAction) PrintA(c *gin.Context) (int, interface{}) {
  	return 0, "I'm A"
  }
  func (h *HttpAction) PrintB(c *gin.Context) (int, interface{}) {
  	return 0, "I'm B"
  }
  
  func TestHttpServer_Start(t *testing.T) {
0e5d52de   zhangqijia   reactor: 重构底层框架1.0
20
  	web := components.NewHttpServer("v1")
62d5d847   zhangqijia   http服务只用写actionSt...
21
22
23
  	web.BindHandler(&HttpAction{})
  	web.Start()
  }