diff --git a/WebApiClient/Attributes/ParameterAttributes/FormContentAttribute.cs b/WebApiClient/Attributes/ParameterAttributes/FormContentAttribute.cs
index 0f231205..7eb1b363 100644
--- a/WebApiClient/Attributes/ParameterAttributes/FormContentAttribute.cs
+++ b/WebApiClient/Attributes/ParameterAttributes/FormContentAttribute.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
using System.Threading.Tasks;
using WebApiClient.Contexts;
@@ -42,7 +43,7 @@ public FormContentAttribute(string datetimeFormat)
///
/// 上下文
/// 特性关联的参数
- protected override async Task SetHttpContentAsync(ApiActionContext context, ApiParameterDescriptor parameter)
+ protected sealed override async Task SetHttpContentAsync(ApiActionContext context, ApiParameterDescriptor parameter)
{
if (this.WillIgnore(parameter.Value) == true)
{
@@ -52,7 +53,20 @@ protected override async Task SetHttpContentAsync(ApiActionContext context, ApiP
var formatter = context.HttpApiConfig.KeyValueFormatter;
var options = context.HttpApiConfig.FormatOptions.CloneChange(this.DateTimeFormat);
var keyValues = formatter.Serialize(parameter, options);
- await context.RequestMessage.AddFormFieldAsync(keyValues).ConfigureAwait(false);
+ var form = this.HandleForm(keyValues);
+ await context.RequestMessage.AddFormFieldAsync(form).ConfigureAwait(false);
+ }
+
+ ///
+ /// 处理表单内容
+ /// 可以重写比方法
+ /// 实现字段排序、插入签名字段等
+ ///
+ /// 表单
+ ///
+ protected virtual IEnumerable> HandleForm(IEnumerable> form)
+ {
+ return form;
}
///