rename struct
This commit is contained in:
parent
ca04024bb1
commit
c47cccf7e9
14
capture.go
14
capture.go
|
@ -26,13 +26,6 @@ type Capture struct {
|
|||
Elapsed time.Duration
|
||||
}
|
||||
|
||||
// CaptureDump is all the dumps shown in the dashboard
|
||||
type CaptureDump struct {
|
||||
Request string `json:"request"`
|
||||
Response string `json:"response"`
|
||||
Curl string `json:"curl"`
|
||||
}
|
||||
|
||||
type Req struct {
|
||||
Proto string
|
||||
Method string
|
||||
|
@ -50,6 +43,13 @@ type Res struct {
|
|||
Body []byte
|
||||
}
|
||||
|
||||
// CaptureInfo is the capture info shown in the dashboard
|
||||
type CaptureInfo struct {
|
||||
Request string `json:"request"`
|
||||
Response string `json:"response"`
|
||||
Curl string `json:"curl"`
|
||||
}
|
||||
|
||||
// DashboardItem is an item in the dashboard's list
|
||||
type DashboardItem struct {
|
||||
ID int `json:"id"`
|
||||
|
|
4
main.go
4
main.go
|
@ -230,10 +230,10 @@ func NewProxyHandler(URL string) http.HandlerFunc {
|
|||
}
|
||||
}
|
||||
|
||||
func dump(c *Capture) CaptureDump {
|
||||
func dump(c *Capture) CaptureInfo {
|
||||
req := c.Req
|
||||
res := c.Res
|
||||
return CaptureDump{
|
||||
return CaptureInfo{
|
||||
Request: dumpContent(req.Header, req.Body, "%s %s %s\n\n", req.Method, req.Path, req.Proto),
|
||||
Response: dumpContent(res.Header, res.Body, "%s %s\n\n", res.Proto, res.Status),
|
||||
Curl: dumpCurl(req),
|
||||
|
|
Loading…
Reference in a new issue