(w http.ResponseWriter, r *http.Request)
| 98 | } |
| 99 | |
| 100 | func (mod *RestAPI) showSession(w http.ResponseWriter, r *http.Request) { |
| 101 | if mod.replaying { |
| 102 | if !mod.record.Session.Over() { |
| 103 | from := mod.record.Session.Index() - 1 |
| 104 | q := r.URL.Query() |
| 105 | vals := q["from"] |
| 106 | if len(vals) > 0 { |
| 107 | if n, err := strconv.Atoi(vals[0]); err == nil { |
| 108 | from = n |
| 109 | } |
| 110 | } |
| 111 | mod.record.Session.SetFrom(from) |
| 112 | |
| 113 | mod.Debug("replaying session %d of %d from %s", |
| 114 | mod.record.Session.Index(), |
| 115 | mod.record.Session.Frames(), |
| 116 | mod.recordFileName) |
| 117 | |
| 118 | mod.State.Store("rec_frames", mod.record.Session.Frames()) |
| 119 | mod.State.Store("rec_cur_frame", mod.record.Session.Index()) |
| 120 | |
| 121 | buf := mod.record.Session.Next() |
| 122 | if frame, err := mod.patchFrame(buf); err != nil { |
| 123 | mod.Error("%v", err) |
| 124 | } else { |
| 125 | mod.toJSON(w, frame) |
| 126 | return |
| 127 | } |
| 128 | } else { |
| 129 | mod.stopReplay() |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | mod.toJSON(w, mod.Session) |
| 134 | } |
| 135 | |
| 136 | func (mod *RestAPI) showBLE(w http.ResponseWriter, r *http.Request) { |
| 137 | params := mux.Vars(r) |
no test coverage detected