proxy
proxy钩子注册到Fireboom中也为一个API,和funciton的区别是:
没有出入参定义,可以为任意类型,如非结构化数据或xml数据
不支持实时查询
推荐优先使用function,funciton满足不了的,再用proxy钩子。

具体操作步骤同 function
示例代码:
package proxy
import (
"custom-go/pkg/base"
"custom-go/pkg/plugins"
"net/http"
)
func init() {
plugins.RegisterProxyHook(ping)
}
func ping(hook *base.HttpTransportHookRequest, body *plugins.HttpTransportBody) (*base.ClientResponse, error) {
// do something here ...
body.Response = &base.ClientResponse{
StatusCode: http.StatusOK,
}
body.Response.OriginBody = []byte("ok")
return body.Response, nil
}
路由规则:
http://localhost:9991/operations/proxy/[proxy-name]
example:: http://localhost:9991/operations/proxy/ping
参考:
最后更新于
这有帮助吗?