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