github.com/TeaOSLab/EdgeNode@v1.3.8/internal/iplibrary/action_base.go (about) 1 package iplibrary 2 3 import ( 4 "encoding/json" 5 "github.com/iwind/TeaGo/maps" 6 "net/http" 7 ) 8 9 type BaseAction struct { 10 } 11 12 func (this *BaseAction) Close() error { 13 return nil 14 } 15 16 // DoHTTP 处理HTTP请求 17 func (this *BaseAction) DoHTTP(req *http.Request, resp http.ResponseWriter) (goNext bool, err error) { 18 return true, nil 19 } 20 21 func (this *BaseAction) convertParams(params maps.Map, ptr interface{}) error { 22 data, err := json.Marshal(params) 23 if err != nil { 24 return err 25 } 26 err = json.Unmarshal(data, ptr) 27 if err != nil { 28 return err 29 } 30 return nil 31 }