fix selection bug after max items
This commit is contained in:
parent
6f8d8ae8ac
commit
b32dd867f5
|
@ -3,6 +3,7 @@ package main
|
|||
import "strconv"
|
||||
|
||||
type Capture struct {
|
||||
ID int `json:"id"`
|
||||
Path string `json:"path"`
|
||||
Method string `json:"method"`
|
||||
Status int `json:"status"`
|
||||
|
@ -32,7 +33,7 @@ func (items *Captures) ToReferences(itemBaseUrl string) []CaptureRef {
|
|||
refs := make([]CaptureRef, len(*items))
|
||||
for i, item := range *items {
|
||||
refs[i] = CaptureRef{
|
||||
ID: i,
|
||||
ID: item.ID,
|
||||
Path: item.Path,
|
||||
Method: item.Method,
|
||||
Status: item.Status,
|
||||
|
|
3
main.go
3
main.go
|
@ -21,6 +21,7 @@ type Transport struct {
|
|||
http.RoundTripper
|
||||
}
|
||||
|
||||
var captureID = 0
|
||||
var captures Captures
|
||||
|
||||
var socket socketio.Socket
|
||||
|
@ -101,12 +102,14 @@ func (t Transport) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||
}
|
||||
|
||||
capture := Capture{
|
||||
ID: captureID,
|
||||
Path: req.URL.Path,
|
||||
Method: req.Method,
|
||||
Status: res.StatusCode,
|
||||
Request: string(reqDump),
|
||||
Response: string(resDump),
|
||||
}
|
||||
captureID++
|
||||
|
||||
captures.Add(capture)
|
||||
emit()
|
||||
|
|
Loading…
Reference in a new issue