fix selection bug after max items

This commit is contained in:
Fabricio 2018-07-26 19:49:12 -03:00
parent 6f8d8ae8ac
commit b32dd867f5
2 changed files with 5 additions and 1 deletions

View file

@ -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,

View file

@ -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()