|
|
@@ -10,13 +10,46 @@ import (
|
|
|
"net/http"
|
|
|
)
|
|
|
|
|
|
-type PassThrough struct {
|
|
|
- HttpMethod string
|
|
|
+func (gw *Gateway) PostBindPassThrough(binder *binding.Binder, simple *SimplePassThrough, middlewares ...api.Handler) {
|
|
|
+ simple.bind(binder, http.MethodPost, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+func (gw *Gateway) DeleteBindPassThrough(binder *binding.Binder, simple *SimplePassThrough, middlewares ...api.Handler) {
|
|
|
+ simple.bind(binder, http.MethodDelete, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+func (gw *Gateway) PutBindPassThrough(binder *binding.Binder, simple *SimplePassThrough, middlewares ...api.Handler) {
|
|
|
+ simple.bind(binder, http.MethodPost, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+func (gw *Gateway) GetBindPassThrough(binder *binding.Binder, simple *SimplePassThrough, middlewares ...api.Handler) {
|
|
|
+ simple.bind(binder, http.MethodGet, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+func (gw *Gateway) BindPassThrough(binder *binding.Binder, passThrough *PassThrough, middlewares ...api.Handler) {
|
|
|
+ passThrough.bind(binder, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+type SimplePassThrough struct {
|
|
|
RelativePath string
|
|
|
ToUrl string
|
|
|
}
|
|
|
|
|
|
-func (gw *Gateway) BindPassThrough(binder *binding.Binder, passThrough *PassThrough, middlewares ...api.Handler) {
|
|
|
+func (simple *SimplePassThrough) bind(binder *binding.Binder, httpMethod string, middlewares ...api.Handler) {
|
|
|
+ passThrough := &PassThrough{
|
|
|
+ HttpMethod: httpMethod,
|
|
|
+ SimplePassThrough: simple,
|
|
|
+ }
|
|
|
+
|
|
|
+ passThrough.bind(binder, middlewares...)
|
|
|
+}
|
|
|
+
|
|
|
+type PassThrough struct {
|
|
|
+ HttpMethod string
|
|
|
+ *SimplePassThrough
|
|
|
+}
|
|
|
+
|
|
|
+func (passThrough *PassThrough) bind(binder *binding.Binder, middlewares ...api.Handler) {
|
|
|
binding.Bind[any](binder, &binding.BindItem[any]{
|
|
|
Method: passThrough.HttpMethod,
|
|
|
SimpleBindItem: &binding.SimpleBindItem[any]{
|