ab.go 939 字节
package protocol

import (
	"encoding/json"
	"gitlab.fjmaimaimai.com/mmm-go/gocomm/pkg/log"
)

/*Compare */
type CompareRequest struct {
	Method string
	RequestUri string
	Head map[string][]string
	Body []byte
	IsRetry bool
}
type CompareResponse struct {
}

type Request struct {
	Host string   `json:"-"`
	Method string  `json:"method"`
	RequestUri string  `json:"request_uri"`
	Head map[string][]string `json:"head"`
	Body interface{} `json:"body"`
	AResp interface{}  `json:"a_resp"`
	BResp interface{} `json:"b_resp"`
}

func NewRequest(host,method,requestUri string,head map[string][]string,body []byte)Request{
	var mapBody = make(map[string]interface{})
	json.Unmarshal(body,&mapBody)
	return Request{
		//Host:host,
		Method:method,
		RequestUri:requestUri,
		Head:head,
		Body:mapBody,
	}
}
func(req Request)GetBody()([]byte){
	data,err:= json.Marshal(req.Body)
	if err!=nil{
		log.Error(err)
		return []byte{}
	}
	return data
}