()
| 24 | ) |
| 25 | |
| 26 | func (s *Server) makeHttpTubeService() *restful.WebService { |
| 27 | ws := new(restful.WebService) |
| 28 | ws.Path("/api/v1/http-tube"). |
| 29 | Consumes(restful.MIME_JSON). |
| 30 | Produces(restful.MIME_JSON) |
| 31 | |
| 32 | tags := []string{"http-tube"} |
| 33 | |
| 34 | ws.Route(ws.POST("/{endpoint}"). |
| 35 | To(func(request *restful.Request, response *restful.Response) { |
| 36 | s.options.httpTubeFact.GetHandleFunc(func(r *http.Request) (string, error) { |
| 37 | return request.PathParameter("endpoint"), nil |
| 38 | }, s.log)(response.ResponseWriter, request.Request) |
| 39 | }). |
| 40 | Doc("trigger the http tube endpoint"). |
| 41 | Metadata(restfulspec.KeyOpenAPITags, tags). |
| 42 | Param(ws.PathParameter("endpoint", "Endpoint").DataType("string")). |
| 43 | Reads(bytesSchema). |
| 44 | Operation("triggerHttpTubeEndpoint")) |
| 45 | return ws |
| 46 | } |
no test coverage detected