| 274 | } |
| 275 | |
| 276 | func (w *wrapTransportPersist) RoundTrip(req *http.Request) (*http.Response, error) { |
| 277 | roundTrips := 0 |
| 278 | if rtVal, ok := w.config["roundTrips"]; ok { |
| 279 | var err error |
| 280 | roundTrips, err = strconv.Atoi(rtVal) |
| 281 | if err != nil { |
| 282 | return nil, err |
| 283 | } |
| 284 | } |
| 285 | roundTrips++ |
| 286 | w.config["roundTrips"] = fmt.Sprintf("%d", roundTrips) |
| 287 | if err := w.persister.Persist(w.config); err != nil { |
| 288 | return nil, err |
| 289 | } |
| 290 | return w.rt.RoundTrip(req) |
| 291 | } |
| 292 | |
| 293 | type pluginPersist struct { |
| 294 | config map[string]string |