Skip to content

Commit

Permalink
feat: 新增ApiHttpClient.PatchAsync
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Sep 6, 2023
1 parent 2045a0b commit 3a8edbe
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion NewLife.Core/Remoting/ApiHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public static HttpRequestMessage BuildRequest(HttpMethod method, String action,
request.RequestUri = new Uri(url, UriKind.RelativeOrAbsolute);
}
}
else if (method == HttpMethod.Post || method == HttpMethod.Put)
else if (method == HttpMethod.Post || method == HttpMethod.Put || method.Method == "PATCH")
{
if (args is Packet pk)
{
Expand Down
14 changes: 14 additions & 0 deletions NewLife.Core/Remoting/ApiHttpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,20 @@ void IConfigMapping.MapConfig(IConfigProvider provider, IConfigSection section)
/// <returns></returns>
public async Task<TResult> PutAsync<TResult>(String action, Object args = null) => await InvokeAsync<TResult>(HttpMethod.Put, action, args);

#if NETSTANDARD2_1_OR_GREATER || NETCOREAPP
/// <summary>异步修改,参数Json打包在Body</summary>
/// <param name="action">服务操作</param>
/// <param name="args">参数</param>
/// <returns></returns>
public async Task<TResult> PatchAsync<TResult>(String action, Object args = null) => await InvokeAsync<TResult>(HttpMethod.Patch, action, args);
#else
/// <summary>异步修改,参数Json打包在Body</summary>
/// <param name="action">服务操作</param>
/// <param name="args">参数</param>
/// <returns></returns>
public async Task<TResult> PatchAsync<TResult>(String action, Object args = null) => await InvokeAsync<TResult>(new HttpMethod("Patch"), action, args);
#endif

/// <summary>异步删除,参数Json打包在Body</summary>
/// <param name="action">服务操作</param>
/// <param name="args">参数</param>
Expand Down

0 comments on commit 3a8edbe

Please sign in to comment.