MCPcopy Index your code
hub / github.com/FunctionStream/function-stream / makeHttpTubeService

Method makeHttpTubeService

server/http_tube_service.go:26–46  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24)
25
26func (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}

Callers 1

startRESTHandlersMethod · 0.95

Calls 1

GetHandleFuncMethod · 0.80

Tested by

no test coverage detected