yjp 1 жил өмнө
parent
commit
3057c5baa4

+ 93 - 93
convenient/domain_gateway/configuration/configuration.go

@@ -81,133 +81,133 @@ func BuildGateway(gw *gateway.Gateway, opts ...Option) {
 	// 创建
 	builder.
 		Url(http.MethodPost, "/configuration/create").
-		Post(gateway.NewPostRequest("",
-			gateway.PostRequestWithUrlTransferFunc(
-				func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
-					jsonBody, err := c.GetJsonBody()
-					if err != nil {
-						return "", err
-					}
-
-					serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
-					if !ok {
-						return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
-					}
+		Post(&gateway.PostRequest{
+			UrlFormFunc: func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
+				jsonBody, err := c.GetJsonBody()
+				if err != nil {
+					return "", err
+				}
 
-					jsonBody.Delete("serviceShortName")
+				serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
+				if !ok {
+					return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
+				}
 
-					serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
-					if !loaded {
-						return "", errors.New("没有注册对应的服务: " + serviceShortName)
-					}
+				jsonBody.Delete("serviceShortName")
 
-					var serviceUrl string
+				serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
+				if !loaded {
+					return "", errors.New("没有注册对应的服务: " + serviceShortName)
+				}
 
-					if strutils.IsStringEmpty(options.serviceApiVersion) {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/create")
-						if err != nil {
-							return "", err
-						}
+				var serviceUrl string
 
-						serviceUrl = innerServiceUrl
-					} else {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/create")
-						if err != nil {
-							return "", err
-						}
+				if strutils.IsStringEmpty(options.serviceApiVersion) {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/create")
+					if err != nil {
+						return "", err
+					}
 
-						serviceUrl = innerServiceUrl
+					serviceUrl = innerServiceUrl
+				} else {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/create")
+					if err != nil {
+						return "", err
 					}
 
-					return serviceUrl, nil
-				})), nil).
+					serviceUrl = innerServiceUrl
+				}
+
+				return serviceUrl, nil
+			},
+		}, nil).
 		Build(createMiddlewares...)
 
 	// 删除
 	builder.
 		Url(http.MethodPost, "/configuration/delete").
-		Post(gateway.NewPostRequest("",
-			gateway.PostRequestWithUrlTransferFunc(
-				func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
-					jsonBody, err := c.GetJsonBody()
-					if err != nil {
-						return "", err
-					}
-
-					serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
-					if !ok {
-						return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
-					}
+		Post(&gateway.PostRequest{
+			UrlFormFunc: func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
+				jsonBody, err := c.GetJsonBody()
+				if err != nil {
+					return "", err
+				}
 
-					jsonBody.Delete("serviceShortName")
+				serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
+				if !ok {
+					return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
+				}
 
-					serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
-					if !loaded {
-						return "", errors.New("没有注册对应的服务: " + serviceShortName)
-					}
+				jsonBody.Delete("serviceShortName")
 
-					var serviceUrl string
+				serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
+				if !loaded {
+					return "", errors.New("没有注册对应的服务: " + serviceShortName)
+				}
 
-					if strutils.IsStringEmpty(options.serviceApiVersion) {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/delete")
-						if err != nil {
-							return "", err
-						}
+				var serviceUrl string
 
-						serviceUrl = innerServiceUrl
-					} else {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/delete")
-						if err != nil {
-							return "", err
-						}
+				if strutils.IsStringEmpty(options.serviceApiVersion) {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/delete")
+					if err != nil {
+						return "", err
+					}
 
-						serviceUrl = innerServiceUrl
+					serviceUrl = innerServiceUrl
+				} else {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/delete")
+					if err != nil {
+						return "", err
 					}
 
-					return serviceUrl, nil
-				})), nil).
+					serviceUrl = innerServiceUrl
+				}
+
+				return serviceUrl, nil
+			},
+		}, nil).
 		Build(deleteMiddlewares...)
 
 	// 查询
 	builder.
 		Url(http.MethodGet, "/configuration/values").
-		Get(gateway.NewGetRequest("",
-			gateway.GetRequestWithUrlTransferFunc(
-				func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
-					queryParams := c.GetQueryParams()
-
-					serviceShortName := queryParams.Get("serviceShortName")
-					if strutils.IsStringEmpty(serviceShortName) {
-						return "", errors.New("没有传递服务名缩写")
-					}
+		Get(&gateway.GetRequest{
+			UrlFormFunc: func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
+				queryParams := c.GetQueryParams()
 
-					queryParams.Delete("serviceShortName")
+				serviceShortName := queryParams.Get("serviceShortName")
+				if strutils.IsStringEmpty(serviceShortName) {
+					return "", errors.New("没有传递服务名缩写")
+				}
 
-					serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
-					if !loaded {
-						return "", errors.New("没有注册对应的服务: " + serviceShortName)
-					}
+				queryParams.Delete("serviceShortName")
 
-					var serviceUrl string
+				serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
+				if !loaded {
+					return "", errors.New("没有注册对应的服务: " + serviceShortName)
+				}
 
-					if strutils.IsStringEmpty(options.serviceApiVersion) {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/values")
-						if err != nil {
-							return "", err
-						}
+				var serviceUrl string
 
-						serviceUrl = innerServiceUrl
-					} else {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/values")
-						if err != nil {
-							return "", err
-						}
+				if strutils.IsStringEmpty(options.serviceApiVersion) {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/configuration/values")
+					if err != nil {
+						return "", err
+					}
 
-						serviceUrl = innerServiceUrl
+					serviceUrl = innerServiceUrl
+				} else {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/configuration/values")
+					if err != nil {
+						return "", err
 					}
 
-					return serviceUrl, nil
-				})), nil).
+					serviceUrl = innerServiceUrl
+				}
+
+				return serviceUrl, nil
+			},
+		}, nil).
 		Build(queryMiddlewares...)
 
 	// 查询注册的服务

+ 79 - 82
convenient/domain_gateway/sql_executor/sql_executor.go

@@ -72,111 +72,108 @@ func BuildGateway(gw *gateway.Gateway, opts ...Option) {
 
 	builder.
 		Url(http.MethodPost, "/sql/execute").
-		Post(gateway.NewPostRequest("",
-			gateway.PostRequestWithUrlTransferFunc(
-				func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
-					jsonBody, err := c.GetJsonBody()
-					if err != nil {
-						return "", err
-					}
+		Post(&gateway.PostRequest{
+			UrlFormFunc: func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
+				jsonBody, err := c.GetJsonBody()
+				if err != nil {
+					return "", err
+				}
 
-					serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
-					if !ok {
-						return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
-					}
-
-					jsonBody.Delete("serviceShortName")
+				serviceShortName, ok := jsonBody.Get("serviceShortName").(string)
+				if !ok {
+					return "", errors.New("没有传递服务名缩写或服务名缩写不是string类型")
+				}
 
-					serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
-					if !loaded {
-						return "", errors.New("没有注册对应的服务: " + serviceShortName)
-					}
+				jsonBody.Delete("serviceShortName")
 
-					var serviceUrl string
+				serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
+				if !loaded {
+					return "", errors.New("没有注册对应的服务: " + serviceShortName)
+				}
 
-					if strutils.IsStringEmpty(options.serviceApiVersion) {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/sql/execute")
-						if err != nil {
-							return "", err
-						}
+				var serviceUrl string
 
-						serviceUrl = innerServiceUrl
-					} else {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/sql/execute")
-						if err != nil {
-							return "", err
-						}
-
-						serviceUrl = innerServiceUrl
-					}
-
-					return serviceUrl, nil
-				}),
-			gateway.PostRequestWithBodyForm(
-				func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
-					err := gateway.AddJsonBodyTenantIDAndUserID(c, "", "executorId")
+				if strutils.IsStringEmpty(options.serviceApiVersion) {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/sql/execute")
 					if err != nil {
-						return nil, err
+						return "", err
 					}
 
-					jsonBody, err := c.GetJsonBody()
+					serviceUrl = innerServiceUrl
+				} else {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/sql/execute")
 					if err != nil {
-						return nil, err
-					}
-
-					userInfo := c.GetUserInfo()
-					if userInfo == nil {
-						jsonBody.Set("executorName", "guest")
-					} else {
-						jsonBody.Set("executorName", userInfo.GetName)
+						return "", err
 					}
 
-					return jsonBody.Map(), nil
-				})), nil).
+					serviceUrl = innerServiceUrl
+				}
+
+				return serviceUrl, nil
+			},
+			BodyFormFunc: func(c *api.Context, _ any, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
+				err := gateway.AddJsonBodyTenantIDAndUserID(c, "", "executorId")
+				if err != nil {
+					return nil, err
+				}
+
+				jsonBody, err := c.GetJsonBody()
+				if err != nil {
+					return nil, err
+				}
+
+				userInfo := c.GetUserInfo()
+				if userInfo == nil {
+					jsonBody.Set("executorName", "guest")
+				} else {
+					jsonBody.Set("executorName", userInfo.GetName)
+				}
+
+				return jsonBody.Map(), nil
+			},
+		}, nil).
 		Build(executeSqlMiddlewares...)
 
 	builder.
 		Url(http.MethodGet, "/sql/execute/log").
-		Get(gateway.NewGetRequest("",
-			gateway.GetRequestWithUrlTransferFunc(
-				func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
-					queryParams := c.GetQueryParams()
-
-					serviceShortName := queryParams.Get("serviceShortName")
-					if strutils.IsStringEmpty(serviceShortName) {
-						return "", errors.New("没有传递服务名缩写")
-					}
+		Get(&gateway.GetRequest{
+			UrlFormFunc: func(c *api.Context, _ string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (string, error) {
+				queryParams := c.GetQueryParams()
 
-					queryParams.Delete("serviceShortName")
+				serviceShortName := queryParams.Get("serviceShortName")
+				if strutils.IsStringEmpty(serviceShortName) {
+					return "", errors.New("没有传递服务名缩写")
+				}
 
-					serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
-					if !loaded {
-						return "", errors.New("没有注册对应的服务: " + serviceShortName)
-					}
+				queryParams.Delete("serviceShortName")
 
-					var serviceUrl string
+				serviceBaseUrl, loaded := serviceBaseUrlMap.Load(serviceShortName)
+				if !loaded {
+					return "", errors.New("没有注册对应的服务: " + serviceShortName)
+				}
 
-					if strutils.IsStringEmpty(options.serviceApiVersion) {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/sql/execute/log")
-						if err != nil {
-							return "", err
-						}
+				var serviceUrl string
 
-						serviceUrl = innerServiceUrl
-					} else {
-						innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/sql/execute/log")
-						if err != nil {
-							return "", err
-						}
+				if strutils.IsStringEmpty(options.serviceApiVersion) {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", "/sql/execute/log")
+					if err != nil {
+						return "", err
+					}
 
-						serviceUrl = innerServiceUrl
+					serviceUrl = innerServiceUrl
+				} else {
+					innerServiceUrl, err := url.JoinPath(serviceBaseUrl.(string), serviceShortName, "/api", options.serviceApiVersion, "/sql/execute/log")
+					if err != nil {
+						return "", err
 					}
 
-					return serviceUrl, nil
-				}),
-			gateway.GetRequestWithQueryParamsForm(
-				gateway.FormQueryParamsWithTenantIDAndUserIDFunc("", "executorId")),
-		), nil).
+					serviceUrl = innerServiceUrl
+				}
+
+				return serviceUrl, nil
+			},
+			QueryParamsFormFunc: gateway.FormQueryParamsWithTenantIDAndUserIDFunc("", "executorId"),
+		}, nil).
 		Build(sqlExecuteLogMiddlewares...)
 
 	// 查询注册的服务

+ 106 - 98
convenient/gwtools/entity_crud/entity_crud.go

@@ -92,9 +92,10 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 		}
 
 		copyBuilder.
-			Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+domainPath+"/create",
-				gateway.PostRequestWithBodyForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
-					_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("tenantId", "createUserId")(c, historyRequests, resultMap)
+			Post(&gateway.PostRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/create",
+				BodyFormFunc: func(c *api.Context, body any, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
+					_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("tenantId", "createUserId")(c, body, historyRequests, resultMap)
 					if err != nil {
 						return nil, err
 					}
@@ -114,7 +115,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 					}
 
 					return jsonBody.Map(), nil
-				})), postRequestCallback).
+				},
+				HeadersFormFunc: nil,
+			}, postRequestCallback).
 			Build(createMiddlewares...)
 	}
 
@@ -124,35 +127,33 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodDelete, domainPath+"/delete")
 
-		queryParamsFormOption := gateway.DeleteRequestWithQueryParamsForm(
-			func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
-				if deleteOptions.beforeBuilderCallback != nil {
-					innerBuilder, err := deleteOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+		copyBuilder.
+			Delete(&gateway.DeleteRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/delete",
+				QueryParamsFormFunc: func(c *api.Context, _ map[string]string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
+					if deleteOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := deleteOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
+
+						copyBuilder = innerBuilder
+					}
+
+					return c.GetQueryParams().Map(), nil
+				},
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if deleteOptions.afterBuilderCallback != nil {
+					innerBuilder, err := deleteOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
 					if err != nil {
-						return nil, err
+						return err
 					}
 
 					copyBuilder = innerBuilder
 				}
 
-				return c.GetQueryParams().Map(), nil
-			})
-
-		deleteRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if deleteOptions.afterBuilderCallback != nil {
-				innerBuilder, err := deleteOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
-				}
-
-				copyBuilder = innerBuilder
-			}
-
-			return nil
-		}
-
-		copyBuilder.
-			Delete(gateway.NewDeleteRequest(simple.ServiceVersionedUrl+domainPath+"/delete", queryParamsFormOption), deleteRequestCallback).
+				return nil
+			}).
 			Build(deleteMiddlewares...)
 	}
 
@@ -162,42 +163,43 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodPut, domainPath+"/update")
 
-		putRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if updateOptions.afterBuilderCallback != nil {
-				innerBuilder, err := updateOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
-				}
-
-				copyBuilder = innerBuilder
-			}
+		copyBuilder.
+			Put(&gateway.PutRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/update",
+				BodyFormFunc: func(c *api.Context, body any, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
+					_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("", "updateUserId")(c, body, historyRequests, resultMap)
+					if err != nil {
+						return nil, err
+					}
 
-			return nil
-		}
+					if updateOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := updateOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
 
-		copyBuilder.Put(gateway.NewPutRequest(simple.ServiceVersionedUrl+domainPath+"/update",
-			gateway.PutRequestWithBodyForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
-				_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("", "updateUserId")(c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
+						copyBuilder = innerBuilder
+					}
 
-				if updateOptions.beforeBuilderCallback != nil {
-					innerBuilder, err := updateOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					jsonBody, err := c.GetJsonBody()
 					if err != nil {
 						return nil, err
 					}
 
-					copyBuilder = innerBuilder
-				}
+					return jsonBody.Map(), nil
+				},
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if updateOptions.afterBuilderCallback != nil {
+					innerBuilder, err := updateOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					if err != nil {
+						return err
+					}
 
-				jsonBody, err := c.GetJsonBody()
-				if err != nil {
-					return nil, err
+					copyBuilder = innerBuilder
 				}
 
-				return jsonBody.Map(), nil
-			})), putRequestCallback).
+				return nil
+			}).
 			Build(updateMiddlewares...)
 	}
 
@@ -207,37 +209,39 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodGet, domainPath+"/query")
 
-		getRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if queryOptions.afterBuilderCallback != nil {
-				innerBuilder, err := queryOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
-				}
-
-				copyBuilder = innerBuilder
-			}
+		copyBuilder.
+			Get(&gateway.GetRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/query",
+				QueryParamsFormFunc: func(c *api.Context, queryParams map[string]string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
+					_, err := gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", "")(c, queryParams, historyRequests, resultMap)
+					if err != nil {
+						return nil, err
+					}
 
-			return nil
-		}
+					if queryOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := queryOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
 
-		copyBuilder.Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+domainPath+"/query",
-			gateway.GetRequestWithQueryParamsForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
-				_, err := gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", "")(c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
+						copyBuilder = innerBuilder
+					}
 
-				if queryOptions.beforeBuilderCallback != nil {
-					innerBuilder, err := queryOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					return c.GetQueryParams().Map(), nil
+				},
+				PathParamsFormFunc: nil,
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if queryOptions.afterBuilderCallback != nil {
+					innerBuilder, err := queryOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
 					if err != nil {
-						return nil, err
+						return err
 					}
 
 					copyBuilder = innerBuilder
 				}
 
-				return c.GetQueryParams().Map(), nil
-			})), getRequestCallback).
+				return nil
+			}).
 			Build(queryMiddlewares...)
 	}
 
@@ -247,34 +251,38 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodGet, domainPath+"/get")
 
-		formQueryParamsOption := gateway.GetRequestWithQueryParamsForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
-			if getByIDOptions.beforeBuilderCallback != nil {
-				innerBuilder, err := getByIDOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
+		copyBuilder.
+			Get(&gateway.GetRequest{
+				Url:             simple.ServiceVersionedUrl + domainPath + "/get",
+				QueryParams:     nil,
+				PathParams:      nil,
+				UrlFormFunc:     nil,
+				HeadersFormFunc: nil,
+				QueryParamsFormFunc: func(c *api.Context, _ map[string]string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
+					if getByIDOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := getByIDOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
 
-				copyBuilder = innerBuilder
-			}
+						copyBuilder = innerBuilder
+					}
 
-			return c.GetQueryParams().Map(), nil
-		})
+					return c.GetQueryParams().Map(), nil
+				},
+				PathParamsFormFunc: nil,
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if getByIDOptions.afterBuilderCallback != nil {
+					innerBuilder, err := getByIDOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					if err != nil {
+						return err
+					}
 
-		getRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if getByIDOptions.afterBuilderCallback != nil {
-				innerBuilder, err := getByIDOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
+					copyBuilder = innerBuilder
 				}
 
-				copyBuilder = innerBuilder
-			}
-
-			return nil
-		}
-
-		copyBuilder.
-			Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+domainPath+"/get", formQueryParamsOption), getRequestCallback).
+				return nil
+			}).
 			Build(getByIDMiddlewares...)
 	}
 }

+ 12 - 4
convenient/gwtools/relation/many2many/many2many.go

@@ -44,7 +44,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右更新
 			builder.
 				Url(http.MethodPost, leftDomainPath+rightDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -52,7 +54,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右查询
 			builder.
 				Url(http.MethodGet, leftDomainPath+rightDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 	}
@@ -62,7 +66,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左更新
 			builder.
 				Url(http.MethodPost, rightDomainPath+leftDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -70,7 +76,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左查询
 			builder.
 				Url(http.MethodGet, rightDomainPath+leftDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 	}

+ 16 - 8
convenient/gwtools/relation/one2many/one2many.go

@@ -44,7 +44,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右更新
 			builder.
 				Url(http.MethodPost, leftDomainPath+rightDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -52,7 +54,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右查询
 			builder.
 				Url(http.MethodGet, leftDomainPath+rightDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 	}
@@ -62,7 +66,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左更新
 			builder.
 				Url(http.MethodPost, rightDomainPath+leftDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -70,7 +76,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左查询
 			builder.
 				Url(http.MethodGet, rightDomainPath+leftDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 
@@ -78,10 +86,10 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左查询,携带左方信息
 			builder.
 				Url(http.MethodGet, rightDomainPath+leftDomainPath+"/queryWith").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/queryWith",
-					gateway.GetRequestWithQueryParamsForm(
-						gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""))),
-					nil).
+				Get(&gateway.GetRequest{
+					Url:                 simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/queryWith",
+					QueryParamsFormFunc: gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""),
+				}, nil).
 				Build()
 		}
 	}

+ 20 - 12
convenient/gwtools/relation/one2one/one2one.go

@@ -44,7 +44,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右更新
 			builder.
 				Url(http.MethodPost, leftDomainPath+rightDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -52,7 +54,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右查询
 			builder.
 				Url(http.MethodGet, leftDomainPath+rightDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 
@@ -60,10 +64,10 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 左到右查询,携带右方信息
 			builder.
 				Url(http.MethodGet, leftDomainPath+rightDomainPath+"/queryWith").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+leftDomainPath+rightDomainPath+"/queryWith",
-					gateway.GetRequestWithQueryParamsForm(
-						gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""))),
-					nil).
+				Get(&gateway.GetRequest{
+					Url:                 simple.ServiceVersionedUrl + leftDomainPath + rightDomainPath + "/queryWith",
+					QueryParamsFormFunc: gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""),
+				}, nil).
 				Build()
 		}
 	}
@@ -73,7 +77,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左更新
 			builder.
 				Url(http.MethodPost, rightDomainPath+leftDomainPath+"/update").
-				Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/update"), nil).
+				Post(&gateway.PostRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/update",
+				}, nil).
 				Build()
 		}
 
@@ -81,7 +87,9 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左查询
 			builder.
 				Url(http.MethodGet, rightDomainPath+leftDomainPath+"/query").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/query"), nil).
+				Get(&gateway.GetRequest{
+					Url: simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/query",
+				}, nil).
 				Build()
 		}
 
@@ -89,10 +97,10 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			// 右到左查询,携带左方信息
 			builder.
 				Url(http.MethodGet, rightDomainPath+leftDomainPath+"/queryWith").
-				Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+rightDomainPath+leftDomainPath+"/queryWith",
-					gateway.GetRequestWithQueryParamsForm(
-						gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""))),
-					nil).
+				Get(&gateway.GetRequest{
+					Url:                 simple.ServiceVersionedUrl + rightDomainPath + leftDomainPath + "/queryWith",
+					QueryParamsFormFunc: gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", ""),
+				}, nil).
 				Build()
 		}
 	}

+ 72 - 67
convenient/gwtools/value_object_crud/value_object_crud.go

@@ -79,29 +79,33 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 			return nil
 		}
 
-		copyBuilder.Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+domainPath+"/create",
-			gateway.PostRequestWithBodyForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
-				_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("tenantId", "createUserId")(c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
-
-				if createOptions.beforeBuilderCallback != nil {
-					innerBuilder, err := createOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+		copyBuilder.
+			Post(&gateway.PostRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/create",
+				BodyFormFunc: func(c *api.Context, body any, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
+					_, err := gateway.FormJsonBodyWithTenantIDAndUserIDFunc("tenantId", "createUserId")(c, body, historyRequests, resultMap)
 					if err != nil {
 						return nil, err
 					}
 
-					copyBuilder = innerBuilder
-				}
+					if createOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := createOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
 
-				jsonBody, err := c.GetJsonBody()
-				if err != nil {
-					return nil, err
-				}
+						copyBuilder = innerBuilder
+					}
 
-				return jsonBody.Map(), nil
-			})), postRequestCallback).
+					jsonBody, err := c.GetJsonBody()
+					if err != nil {
+						return nil, err
+					}
+
+					return jsonBody.Map(), nil
+				},
+				HeadersFormFunc: nil,
+			}, postRequestCallback).
 			Build(createMiddlewares...)
 	}
 
@@ -111,39 +115,39 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodPost, domainPath+"/delete")
 
-		formBodyOption := gateway.PostRequestWithBodyForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
-			if deleteOptions.beforeBuilderCallback != nil {
-				innerBuilder, err := deleteOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
-
-				copyBuilder = innerBuilder
-			}
+		copyBuilder.
+			Post(&gateway.PostRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/delete",
+				BodyFormFunc: func(c *api.Context, _ any, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (any, error) {
+					if deleteOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := deleteOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
+
+						copyBuilder = innerBuilder
+					}
 
-			jsonBody, err := c.GetJsonBody()
-			if err != nil {
-				return nil, err
-			}
+					jsonBody, err := c.GetJsonBody()
+					if err != nil {
+						return nil, err
+					}
 
-			return jsonBody.Map(), nil
-		})
+					return jsonBody.Map(), nil
+				},
+				HeadersFormFunc: nil,
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if deleteOptions.afterBuilderCallback != nil {
+					innerBuilder, err := deleteOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					if err != nil {
+						return err
+					}
 
-		postRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if deleteOptions.afterBuilderCallback != nil {
-				innerBuilder, err := deleteOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
+					copyBuilder = innerBuilder
 				}
 
-				copyBuilder = innerBuilder
-			}
-
-			return nil
-		}
-
-		copyBuilder.
-			Post(gateway.NewPostRequest(simple.ServiceVersionedUrl+domainPath+"/delete", formBodyOption), postRequestCallback).
+				return nil
+			}).
 			Build(deleteMiddlewares...)
 	}
 
@@ -153,37 +157,38 @@ func (simple *Simple) bind(builder *gateway.Builder) {
 
 		copyBuilder := builder.Url(http.MethodGet, domainPath+"/query")
 
-		getRequestCallback := func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
-			if queryOptions.afterBuilderCallback != nil {
-				innerBuilder, err := queryOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
-				if err != nil {
-					return err
-				}
-
-				copyBuilder = innerBuilder
-			}
+		copyBuilder.
+			Get(&gateway.GetRequest{
+				Url: simple.ServiceVersionedUrl + domainPath + "/query",
+				QueryParamsFormFunc: func(c *api.Context, queryParams map[string]string, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
+					_, err := gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", "")(c, queryParams, historyRequests, resultMap)
+					if err != nil {
+						return nil, err
+					}
 
-			return nil
-		}
+					if queryOptions.beforeBuilderCallback != nil {
+						innerBuilder, err := queryOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+						if err != nil {
+							return nil, err
+						}
 
-		copyBuilder.Get(gateway.NewGetRequest(simple.ServiceVersionedUrl+domainPath+"/query",
-			gateway.GetRequestWithQueryParamsForm(func(c *api.Context, historyRequests []gateway.BuilderRequest, resultMap map[string]any) (map[string]string, error) {
-				_, err := gateway.FormQueryParamsWithTenantIDAndUserIDFunc("tenantId", "")(c, historyRequests, resultMap)
-				if err != nil {
-					return nil, err
-				}
+						copyBuilder = innerBuilder
+					}
 
-				if queryOptions.beforeBuilderCallback != nil {
-					innerBuilder, err := queryOptions.beforeBuilderCallback(copyBuilder, c, historyRequests, resultMap)
+					return c.GetQueryParams().Map(), nil
+				},
+			}, func(c *api.Context, response *http_client.Response, historyRequests []gateway.BuilderRequest, resultMap map[string]any) error {
+				if queryOptions.afterBuilderCallback != nil {
+					innerBuilder, err := queryOptions.afterBuilderCallback(copyBuilder, c, historyRequests, resultMap)
 					if err != nil {
-						return nil, err
+						return err
 					}
 
 					copyBuilder = innerBuilder
 				}
 
-				return c.GetQueryParams().Map(), nil
-			})), getRequestCallback).
+				return nil
+			}).
 			Build(queryMiddlewares...)
 	}
 }

+ 36 - 4
framework/core/api/context.go

@@ -15,6 +15,7 @@ const (
 	bodyKey        = "body-context"
 	queryParamsKey = "query-params-context"
 	pathParamsKey  = "path-params-context"
+	headerKey      = "header-context"
 )
 
 type Context struct {
@@ -44,14 +45,45 @@ func (c *Context) GetFileHeaderBytes(fileHeader *multipart.FileHeader) (string,
 	return fileHeader.Filename, contentBytes, nil
 }
 
-func (c *Context) GetHeaders() map[string]string {
-	headers := make(map[string]string)
+type Header struct {
+	c      *Context
+	header map[string]string
+}
+
+func (header *Header) Set(key string, value string) {
+	header.header[key] = value
+	header.c.Set(headerKey, header.header)
+}
+
+func (header *Header) Get(key string) string {
+	return header.header[key]
+}
+
+func (header *Header) Map() map[string]string {
+	return header.header
+}
+
+func (c *Context) GetHeader() *Header {
+	savedHeader, exist := c.Get(headerKey)
+	if exist {
+		return &Header{
+			c:      c,
+			header: savedHeader.(map[string]string),
+		}
+	}
+
+	header := make(map[string]string)
 
 	for key, values := range c.Request.Header {
-		headers[key] = strings.Join(values, ",")
+		header[key] = strings.Join(values, ",")
 	}
 
-	return headers
+	c.Set(headerKey, header)
+
+	return &Header{
+		c:      c,
+		header: header,
+	}
 }
 
 type CacheBody struct {

+ 258 - 321
framework/gateway/builder_request.go

@@ -5,14 +5,14 @@ import (
 	"git.sxidc.com/go-tools/utils/http_client"
 )
 
-type UrlTransferFunc func(c *api.Context, url string, historyRequests []BuilderRequest, resultMap map[string]any) (string, error)
-type HeadersFormFunc func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
-type BodyFormFunc func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (any, error)
-type QueryParamsFormFunc func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
-type PathParamsFormFunc func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
+type UrlFormFunc func(c *api.Context, staticUrl string, historyRequests []BuilderRequest, resultMap map[string]any) (string, error)
+type HeadersFormFunc func(c *api.Context, staticHeaders map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
+type BodyFormFunc func(c *api.Context, staticBody any, historyRequests []BuilderRequest, resultMap map[string]any) (any, error)
+type QueryParamsFormFunc func(c *api.Context, staticQueryParams map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
+type PathParamsFormFunc func(c *api.Context, staticPathParams map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error)
 
 func FormJsonBodyWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDFieldName string) BodyFormFunc {
-	return func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (any, error) {
+	return func(c *api.Context, staticBody any, historyRequests []BuilderRequest, resultMap map[string]any) (any, error) {
 		err := AddJsonBodyTenantIDAndUserID(c, tenantIDFieldName, userIDFieldName)
 		if err != nil {
 			return nil, err
@@ -28,7 +28,7 @@ func FormJsonBodyWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDField
 }
 
 func FormQueryParamsWithTenantIDAndUserIDFunc(tenantIDFieldName string, userIDFieldName string) QueryParamsFormFunc {
-	return func(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error) {
+	return func(c *api.Context, staticQueryParams map[string]string, historyRequests []BuilderRequest, resultMap map[string]any) (map[string]string, error) {
 		err := AddQueryParamsTenantIDAndUserID(c, tenantIDFieldName, userIDFieldName)
 		if err != nil {
 			return nil, err
@@ -43,445 +43,382 @@ type BuilderRequest interface {
 	Response() *http_client.Response
 }
 
-type PostRequestOption func(options *PostRequestOptions)
-
-type PostRequestOptions struct {
-	urlTransferFunc UrlTransferFunc
-	headersFormFunc HeadersFormFunc
-	bodyFormFunc    BodyFormFunc
-}
-
-func PostRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) PostRequestOption {
-	return func(options *PostRequestOptions) {
-		options.urlTransferFunc = urlTransferFunc
-	}
-}
-
-func PostRequestWithHeadersForm(headersFormFunc HeadersFormFunc) PostRequestOption {
-	return func(options *PostRequestOptions) {
-		options.headersFormFunc = headersFormFunc
-	}
-}
-
-func PostRequestWithBodyForm(bodyFormFunc BodyFormFunc) PostRequestOption {
-	return func(options *PostRequestOptions) {
-		options.bodyFormFunc = bodyFormFunc
-	}
-}
-
 type PostRequest struct {
-	url      string
-	response *http_client.Response
-	options  *PostRequestOptions
-}
-
-func NewPostRequest(url string, opts ...PostRequestOption) *PostRequest {
-	options := new(PostRequestOptions)
-
-	for _, opt := range opts {
-		opt(options)
-	}
-
-	if options.urlTransferFunc == nil {
-		options.urlTransferFunc = defaultUrlTransferFunc
-	}
-
-	if options.headersFormFunc == nil {
-		options.headersFormFunc = defaultHeadersFormFunc
-	}
-
-	if options.bodyFormFunc == nil {
-		options.bodyFormFunc = defaultBodyFormFunc
-	}
+	Url             string
+	Body            any
+	UrlFormFunc     UrlFormFunc
+	BodyFormFunc    BodyFormFunc
+	HeadersFormFunc HeadersFormFunc
 
-	return &PostRequest{
-		url:     url,
-		options: options,
-	}
+	headers  map[string]string
+	response *http_client.Response
 }
 
 func (req *PostRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
-	url, err := req.options.urlTransferFunc(c, req.url, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
-	}
-
-	headers, err := req.options.headersFormFunc(c, historyRequests, resultMap)
+	preparedRequest, err := req.prepare(c, historyRequests, resultMap)
 	if err != nil {
 		return nil, err
 	}
 
-	body, err := req.options.bodyFormFunc(c, historyRequests, resultMap)
+	response, err := request.Post(preparedRequest.Url, preparedRequest.Body,
+		http_client.WithRequestHeaders(preparedRequest.headers))
 	if err != nil {
 		return nil, err
 	}
 
-	response, err := request.Post(url, body, http_client.WithRequestHeaders(headers))
-	if err != nil {
-		return nil, err
-	}
+	preparedRequest.response = response
 
-	return &PostRequest{
-		url:      url,
-		response: response,
-		options: &PostRequestOptions{
-			urlTransferFunc: req.options.urlTransferFunc,
-			headersFormFunc: req.options.headersFormFunc,
-			bodyFormFunc:    req.options.bodyFormFunc,
-		},
-	}, nil
+	return preparedRequest, nil
 }
 
 func (req *PostRequest) Response() *http_client.Response {
 	return req.response
 }
 
-type DeleteRequestOption func(options *DeleteRequestOptions)
-
-type DeleteRequestOptions struct {
-	urlTransferFunc     UrlTransferFunc
-	headersFormFunc     HeadersFormFunc
-	pathParamsFormFunc  PathParamsFormFunc
-	queryParamsFormFunc QueryParamsFormFunc
-}
-
-func DeleteRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) DeleteRequestOption {
-	return func(options *DeleteRequestOptions) {
-		options.urlTransferFunc = urlTransferFunc
+func (req *PostRequest) prepare(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (*PostRequest, error) {
+	preparedRequest := &PostRequest{
+		Url:             req.Url,
+		Body:            req.Body,
+		UrlFormFunc:     req.UrlFormFunc,
+		HeadersFormFunc: req.HeadersFormFunc,
+		BodyFormFunc:    req.BodyFormFunc,
 	}
-}
-
-func DeleteRequestWithHeadersForm(headersFormFunc HeadersFormFunc) DeleteRequestOption {
-	return func(options *DeleteRequestOptions) {
-		options.headersFormFunc = headersFormFunc
-	}
-}
 
-func DeleteRequestWithPathParamsForm(pathParamsFormFunc PathParamsFormFunc) DeleteRequestOption {
-	return func(options *DeleteRequestOptions) {
-		options.pathParamsFormFunc = pathParamsFormFunc
-	}
-}
+	// 赋值默认body
+	if req.Body == nil {
+		cacheBody, err := c.GetBytesBody()
+		if err != nil {
+			return nil, err
+		}
 
-func DeleteRequestWithQueryParamsForm(queryParamsFormFunc QueryParamsFormFunc) DeleteRequestOption {
-	return func(options *DeleteRequestOptions) {
-		options.queryParamsFormFunc = queryParamsFormFunc
+		preparedRequest.Body = cacheBody.Bytes()
 	}
-}
 
-type DeleteRequest struct {
-	url      string
-	response *http_client.Response
-	options  *DeleteRequestOptions
-}
+	// 赋值默认headers
+	preparedRequest.headers = c.GetHeader().Map()
 
-func NewDeleteRequest(url string, opts ...DeleteRequestOption) *DeleteRequest {
-	options := new(DeleteRequestOptions)
+	// 构造url
+	if preparedRequest.UrlFormFunc != nil {
+		formedUrl, err := preparedRequest.UrlFormFunc(c, preparedRequest.Url, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	for _, opt := range opts {
-		opt(options)
+		preparedRequest.Url = formedUrl
 	}
 
-	if options.urlTransferFunc == nil {
-		options.urlTransferFunc = defaultUrlTransferFunc
-	}
+	// 构造body
+	if preparedRequest.BodyFormFunc != nil {
+		formedBody, err := preparedRequest.BodyFormFunc(c, preparedRequest.Body, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	if options.headersFormFunc == nil {
-		options.headersFormFunc = defaultHeadersFormFunc
+		preparedRequest.Body = formedBody
 	}
 
-	if options.pathParamsFormFunc == nil {
-		options.pathParamsFormFunc = defaultPathParamsFormFunc
-	}
+	// 构造headers
+	if preparedRequest.HeadersFormFunc != nil {
+		formedHeaders, err := preparedRequest.HeadersFormFunc(c, preparedRequest.headers, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	if options.queryParamsFormFunc == nil {
-		options.queryParamsFormFunc = defaultQueryParamsFormFunc
+		preparedRequest.headers = formedHeaders
 	}
 
-	return &DeleteRequest{
-		url:     url,
-		options: options,
-	}
+	return preparedRequest, nil
 }
 
-func (req *DeleteRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
-	url, err := req.options.urlTransferFunc(c, req.url, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
-	}
-
-	headers, err := req.options.headersFormFunc(c, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
-	}
+type DeleteRequest struct {
+	Url                 string
+	QueryParams         map[string]string
+	PathParams          map[string]string
+	UrlFormFunc         UrlFormFunc
+	HeadersFormFunc     HeadersFormFunc
+	QueryParamsFormFunc QueryParamsFormFunc
+	PathParamsFormFunc  PathParamsFormFunc
+
+	headers  map[string]string
+	response *http_client.Response
+}
 
-	pathParams, err := req.options.pathParamsFormFunc(c, historyRequests, resultMap)
+func (req *DeleteRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
+	preparedRequest, err := req.prepare(c, historyRequests, resultMap)
 	if err != nil {
 		return nil, err
 	}
 
-	queryParams, err := req.options.queryParamsFormFunc(c, historyRequests, resultMap)
+	response, err := request.Delete(preparedRequest.Url,
+		http_client.WithRequestQueryParams(preparedRequest.QueryParams),
+		http_client.WithRequestPathParams(preparedRequest.PathParams),
+		http_client.WithRequestHeaders(preparedRequest.headers))
 	if err != nil {
 		return nil, err
 	}
 
-	response, err := request.Delete(url,
-		http_client.WithRequestHeaders(headers),
-		http_client.WithRequestPathParams(pathParams),
-		http_client.WithRequestQueryParams(queryParams))
-	if err != nil {
-		return nil, err
-	}
+	preparedRequest.response = response
 
-	return &DeleteRequest{
-		url:      url,
-		response: response,
-		options: &DeleteRequestOptions{
-			urlTransferFunc:     req.options.urlTransferFunc,
-			headersFormFunc:     req.options.headersFormFunc,
-			pathParamsFormFunc:  req.options.pathParamsFormFunc,
-			queryParamsFormFunc: req.options.queryParamsFormFunc,
-		},
-	}, nil
+	return preparedRequest, nil
 }
 
 func (req *DeleteRequest) Response() *http_client.Response {
 	return req.response
 }
 
-type PutRequestOption func(options *PutRequestOptions)
-
-type PutRequestOptions struct {
-	urlTransferFunc UrlTransferFunc
-	headersFormFunc HeadersFormFunc
-	bodyFormFunc    BodyFormFunc
-}
-
-func PutRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) PutRequestOption {
-	return func(options *PutRequestOptions) {
-		options.urlTransferFunc = urlTransferFunc
+func (req *DeleteRequest) prepare(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (*DeleteRequest, error) {
+	preparedRequest := &DeleteRequest{
+		Url:                 req.Url,
+		QueryParams:         req.QueryParams,
+		PathParams:          req.PathParams,
+		UrlFormFunc:         req.UrlFormFunc,
+		HeadersFormFunc:     req.HeadersFormFunc,
+		QueryParamsFormFunc: req.QueryParamsFormFunc,
+		PathParamsFormFunc:  req.PathParamsFormFunc,
 	}
-}
 
-func PutRequestWithHeadersForm(headersFormFunc HeadersFormFunc) PutRequestOption {
-	return func(options *PutRequestOptions) {
-		options.headersFormFunc = headersFormFunc
+	// 赋值默认查询参数
+	if req.QueryParams == nil || len(req.QueryParams) == 0 {
+		req.QueryParams = c.GetQueryParams().Map()
 	}
-}
 
-func PutRequestWithBodyForm(bodyFormFunc BodyFormFunc) PutRequestOption {
-	return func(options *PutRequestOptions) {
-		options.bodyFormFunc = bodyFormFunc
+	// 赋值默认路径参数
+	if req.PathParams == nil || len(req.PathParams) == 0 {
+		req.PathParams = c.GetPathParams().Map()
 	}
-}
 
-type PutRequest struct {
-	url      string
-	response *http_client.Response
-	options  *PutRequestOptions
-}
+	// 赋值默认headers
+	preparedRequest.headers = c.GetHeader().Map()
 
-func NewPutRequest(url string, opts ...PutRequestOption) *PutRequest {
-	options := new(PutRequestOptions)
+	// 构造url
+	if preparedRequest.UrlFormFunc != nil {
+		formedUrl, err := preparedRequest.UrlFormFunc(c, preparedRequest.Url, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	for _, opt := range opts {
-		opt(options)
+		preparedRequest.Url = formedUrl
 	}
 
-	if options.urlTransferFunc == nil {
-		options.urlTransferFunc = defaultUrlTransferFunc
-	}
+	// 构造查询参数
+	if preparedRequest.QueryParamsFormFunc != nil {
+		formedQueryParams, err := preparedRequest.QueryParamsFormFunc(c, preparedRequest.QueryParams, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	if options.headersFormFunc == nil {
-		options.headersFormFunc = defaultHeadersFormFunc
+		preparedRequest.QueryParams = formedQueryParams
 	}
 
-	if options.bodyFormFunc == nil {
-		options.bodyFormFunc = defaultBodyFormFunc
+	// 构造路径参数
+	if preparedRequest.PathParamsFormFunc != nil {
+		formedPathParams, err := preparedRequest.PathParamsFormFunc(c, preparedRequest.PathParams, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
+
+		preparedRequest.PathParams = formedPathParams
 	}
 
-	return &PutRequest{
-		url:     url,
-		options: options,
+	// 构造headers
+	if preparedRequest.HeadersFormFunc != nil {
+		formedHeaders, err := preparedRequest.HeadersFormFunc(c, preparedRequest.headers, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
+
+		preparedRequest.headers = formedHeaders
 	}
+
+	return preparedRequest, nil
 }
 
-func (req *PutRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
-	url, err := req.options.urlTransferFunc(c, req.url, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
-	}
+type PutRequest struct {
+	Url             string
+	Body            any
+	UrlFormFunc     UrlFormFunc
+	BodyFormFunc    BodyFormFunc
+	HeadersFormFunc HeadersFormFunc
 
-	headers, err := req.options.headersFormFunc(c, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
-	}
+	headers  map[string]string
+	response *http_client.Response
+}
 
-	body, err := req.options.bodyFormFunc(c, historyRequests, resultMap)
+func (req *PutRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
+	preparedRequest, err := req.prepare(c, historyRequests, resultMap)
 	if err != nil {
 		return nil, err
 	}
 
-	response, err := request.Put(url, body, http_client.WithRequestHeaders(headers))
+	response, err := request.Put(preparedRequest.Url, preparedRequest.Body,
+		http_client.WithRequestHeaders(preparedRequest.headers))
 	if err != nil {
 		return nil, err
 	}
 
-	return &PutRequest{
-		url:      url,
-		response: response,
-		options: &PutRequestOptions{
-			urlTransferFunc: req.options.urlTransferFunc,
-			headersFormFunc: req.options.headersFormFunc,
-			bodyFormFunc:    req.options.bodyFormFunc,
-		},
-	}, nil
+	preparedRequest.response = response
+
+	return preparedRequest, nil
 }
 
 func (req *PutRequest) Response() *http_client.Response {
 	return req.response
 }
 
-type GetRequestOption func(options *GetRequestOptions)
-
-type GetRequestOptions struct {
-	urlTransferFunc     UrlTransferFunc
-	headersFormFunc     HeadersFormFunc
-	pathParamsFormFunc  PathParamsFormFunc
-	queryParamsFormFunc QueryParamsFormFunc
-}
-
-func GetRequestWithUrlTransferFunc(urlTransferFunc UrlTransferFunc) GetRequestOption {
-	return func(options *GetRequestOptions) {
-		options.urlTransferFunc = urlTransferFunc
+func (req *PutRequest) prepare(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (*PutRequest, error) {
+	preparedRequest := &PutRequest{
+		Url:             req.Url,
+		Body:            req.Body,
+		UrlFormFunc:     req.UrlFormFunc,
+		HeadersFormFunc: req.HeadersFormFunc,
+		BodyFormFunc:    req.BodyFormFunc,
 	}
-}
-
-func GetRequestWithHeadersForm(headersFormFunc HeadersFormFunc) GetRequestOption {
-	return func(options *GetRequestOptions) {
-		options.headersFormFunc = headersFormFunc
-	}
-}
 
-func GetRequestWithPathParamsForm(pathParamsFormFunc PathParamsFormFunc) GetRequestOption {
-	return func(options *GetRequestOptions) {
-		options.pathParamsFormFunc = pathParamsFormFunc
-	}
-}
+	// 赋值默认body
+	if req.Body == nil {
+		cacheBody, err := c.GetBytesBody()
+		if err != nil {
+			return nil, err
+		}
 
-func GetRequestWithQueryParamsForm(queryParamsFormFunc QueryParamsFormFunc) GetRequestOption {
-	return func(options *GetRequestOptions) {
-		options.queryParamsFormFunc = queryParamsFormFunc
+		preparedRequest.Body = cacheBody.Bytes()
 	}
-}
 
-type GetRequest struct {
-	url         string
-	headers     map[string]string
-	pathParams  map[string]string
-	queryParams map[string]string
-	response    *http_client.Response
-	options     *GetRequestOptions
-}
+	// 赋值默认headers
+	preparedRequest.headers = c.GetHeader().Map()
 
-func NewGetRequest(url string, opts ...GetRequestOption) *GetRequest {
-	options := new(GetRequestOptions)
+	// 构造url
+	if preparedRequest.UrlFormFunc != nil {
+		formedUrl, err := preparedRequest.UrlFormFunc(c, preparedRequest.Url, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	for _, opt := range opts {
-		opt(options)
+		preparedRequest.Url = formedUrl
 	}
 
-	if options.urlTransferFunc == nil {
-		options.urlTransferFunc = defaultUrlTransferFunc
-	}
+	// 构造body
+	if preparedRequest.BodyFormFunc != nil {
+		formedBody, err := preparedRequest.BodyFormFunc(c, preparedRequest.Body, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	if options.headersFormFunc == nil {
-		options.headersFormFunc = defaultHeadersFormFunc
+		preparedRequest.Body = formedBody
 	}
 
-	if options.pathParamsFormFunc == nil {
-		options.pathParamsFormFunc = defaultPathParamsFormFunc
-	}
+	// 构造headers
+	if preparedRequest.HeadersFormFunc != nil {
+		formedHeaders, err := preparedRequest.HeadersFormFunc(c, preparedRequest.headers, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-	if options.queryParamsFormFunc == nil {
-		options.queryParamsFormFunc = defaultQueryParamsFormFunc
+		preparedRequest.headers = formedHeaders
 	}
 
-	return &GetRequest{
-		url:     url,
-		options: options,
-	}
+	return preparedRequest, nil
+}
+
+type GetRequest struct {
+	Url                 string
+	QueryParams         map[string]string
+	PathParams          map[string]string
+	UrlFormFunc         UrlFormFunc
+	HeadersFormFunc     HeadersFormFunc
+	QueryParamsFormFunc QueryParamsFormFunc
+	PathParamsFormFunc  PathParamsFormFunc
+
+	headers  map[string]string
+	response *http_client.Response
 }
 
 func (req *GetRequest) Request(c *api.Context, request *http_client.Request, historyRequests []BuilderRequest, resultMap map[string]any) (BuilderRequest, error) {
-	url, err := req.options.urlTransferFunc(c, req.url, historyRequests, resultMap)
+	preparedRequest, err := req.prepare(c, historyRequests, resultMap)
 	if err != nil {
 		return nil, err
 	}
 
-	headers, err := req.options.headersFormFunc(c, historyRequests, resultMap)
+	response, err := request.Get(preparedRequest.Url,
+		http_client.WithRequestQueryParams(preparedRequest.QueryParams),
+		http_client.WithRequestPathParams(preparedRequest.PathParams),
+		http_client.WithRequestHeaders(preparedRequest.headers))
 	if err != nil {
 		return nil, err
 	}
 
-	pathParams, err := req.options.pathParamsFormFunc(c, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
+	preparedRequest.response = response
+
+	return preparedRequest, nil
+}
+
+func (req *GetRequest) Response() *http_client.Response {
+	return req.response
+}
+
+func (req *GetRequest) prepare(c *api.Context, historyRequests []BuilderRequest, resultMap map[string]any) (*DeleteRequest, error) {
+	preparedRequest := &DeleteRequest{
+		Url:                 req.Url,
+		QueryParams:         req.QueryParams,
+		PathParams:          req.PathParams,
+		UrlFormFunc:         req.UrlFormFunc,
+		HeadersFormFunc:     req.HeadersFormFunc,
+		QueryParamsFormFunc: req.QueryParamsFormFunc,
+		PathParamsFormFunc:  req.PathParamsFormFunc,
 	}
 
-	queryParams, err := req.options.queryParamsFormFunc(c, historyRequests, resultMap)
-	if err != nil {
-		return nil, err
+	// 赋值默认查询参数
+	if req.QueryParams == nil || len(req.QueryParams) == 0 {
+		req.QueryParams = c.GetQueryParams().Map()
 	}
 
-	response, err := request.Get(url,
-		http_client.WithRequestHeaders(headers),
-		http_client.WithRequestPathParams(pathParams),
-		http_client.WithRequestQueryParams(queryParams))
-	if err != nil {
-		return nil, err
+	// 赋值默认路径参数
+	if req.PathParams == nil || len(req.PathParams) == 0 {
+		req.PathParams = c.GetPathParams().Map()
 	}
 
-	return &GetRequest{
-		url:         url,
-		headers:     headers,
-		pathParams:  pathParams,
-		queryParams: queryParams,
-		response:    response,
-		options: &GetRequestOptions{
-			urlTransferFunc:     req.options.urlTransferFunc,
-			headersFormFunc:     req.options.headersFormFunc,
-			pathParamsFormFunc:  req.options.pathParamsFormFunc,
-			queryParamsFormFunc: req.options.queryParamsFormFunc,
-		},
-	}, nil
-}
+	// 赋值默认headers
+	preparedRequest.headers = c.GetHeader().Map()
 
-func (req *GetRequest) Response() *http_client.Response {
-	return req.response
-}
+	// 构造url
+	if preparedRequest.UrlFormFunc != nil {
+		formedUrl, err := preparedRequest.UrlFormFunc(c, preparedRequest.Url, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-func defaultUrlTransferFunc(_ *api.Context, url string, _ []BuilderRequest, _ map[string]any) (string, error) {
-	return url, nil
-}
+		preparedRequest.Url = formedUrl
+	}
 
-func defaultHeadersFormFunc(c *api.Context, _ []BuilderRequest, _ map[string]any) (map[string]string, error) {
-	return c.GetHeaders(), nil
-}
+	// 构造查询参数
+	if preparedRequest.QueryParamsFormFunc != nil {
+		formedQueryParams, err := preparedRequest.QueryParamsFormFunc(c, preparedRequest.QueryParams, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-func defaultBodyFormFunc(c *api.Context, _ []BuilderRequest, _ map[string]any) (any, error) {
-	cachedBody, err := c.GetBytesBody()
-	if err != nil {
-		return nil, err
+		preparedRequest.QueryParams = formedQueryParams
 	}
 
-	return cachedBody.Bytes(), nil
-}
+	// 构造路径参数
+	if preparedRequest.PathParamsFormFunc != nil {
+		formedPathParams, err := preparedRequest.PathParamsFormFunc(c, preparedRequest.PathParams, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
 
-func defaultQueryParamsFormFunc(c *api.Context, _ []BuilderRequest, _ map[string]any) (map[string]string, error) {
-	return c.GetQueryParams().Map(), nil
-}
+		preparedRequest.PathParams = formedPathParams
+	}
+
+	// 构造headers
+	if preparedRequest.HeadersFormFunc != nil {
+		formedHeaders, err := preparedRequest.HeadersFormFunc(c, preparedRequest.headers, historyRequests, resultMap)
+		if err != nil {
+			return nil, err
+		}
+
+		preparedRequest.headers = formedHeaders
+	}
 
-func defaultPathParamsFormFunc(c *api.Context, _ []BuilderRequest, _ map[string]any) (map[string]string, error) {
-	return c.GetPathParams().Map(), nil
+	return preparedRequest, nil
 }