(path string, prepare PrepareFn)
| 66 | } |
| 67 | |
| 68 | func (opHttp *operatorHTTP) AddPreparedEndpoint(path string, prepare PrepareFn) PrepareFlagFn { |
| 69 | if prepare == nil { |
| 70 | panic("passed nil value for prepare function") |
| 71 | } |
| 72 | _, exists := opHttp.results[path] |
| 73 | if exists { |
| 74 | panic("prepared result exists for path: " + path) |
| 75 | } |
| 76 | |
| 77 | entry := preparedEntry{ |
| 78 | data: newPreparedResult(), |
| 79 | prepare: prepare, |
| 80 | } |
| 81 | opHttp.results[path] = entry |
| 82 | |
| 83 | opHttp.router.HandleFunc(path, func(rw http.ResponseWriter, _ *http.Request) { |
| 84 | servePreparedResult(rw, entry.data) |
| 85 | }).Methods(http.MethodGet) |
| 86 | |
| 87 | return entry.data.Flag |
| 88 | } |
| 89 | |
| 90 | func (opHttp *operatorHTTP) PrepareAll() error { |
| 91 | for _, entry := range opHttp.results { |
nothing calls this directly
no test coverage detected