WebApiClient
WebApiClient copied to clipboard
An open source project based on the HttpClient. You only need to define the c# interface and modify the related features to invoke the client library of the remote http interface asynchronously.
 使用: > WebApiClientCore > WebApiClientCore.Extensions.NewtonsoftJson netcore:6.0 ` [HttpHost("https://vroom.hesint.net")] public interface ITestAPI : IHttpApi { [HttpPost("api/_SMS/SendSMS")] [JsonReturn] Task Send([JsonContent] SendSms sendSms); } public class SendSms { /// /// /// public...
如果用FormDataContent实现muti-part 文件和meta上传
services.AddHttpApi(); services.AddHttpApi(); services.AddTokenProvider(async s => { return await s.GetService().RequestTokenAsync(); }); IUserApi可以通过[Uri] string host,来动态设置Host,ITokenApi能否直接继承host参数呢?
WebApiClient.JIT版本实现如下: /// /// 使用设置代理(本地) /// public class LocalProxy : ApiActionFilterAttribute { public override Task OnBeginRequestAsync(ApiActionContext context) { var webProxy = new WebProxy("127.0.0.1", 8888); context.HttpApiConfig.HttpHandler.UseProxy = true; context.HttpApiConfig.HttpHandler.Proxy = webProxy; return...
Is there any roadmap in the future?such as gRPC .
1、变更 OAuthTokenAttribute 中的 OnRequestAsync 和 OnResponseAsync 方法为可继承。 2、增加 同套接口支持多应用轮换使用的模式,需要继承 IDynamicTokenProvider。 3、增加 DynamicTokenAttribute 特性,表示此接口支持多个应用Token,构造参数表示应用标识。 3、增加 特性值模板化扩展方法,使用参数替换模板值。如:[DynamicToken("AppID_{app_id}_Token")]表示{app_id}取值于参数app_id。 4、增加 IgnoreAttribute,表示仅用于给特性传值使用,不用于接口传值。 示例: ``` public class CuntomTokenProvider : DynamicTokenProvider { public Dictionary apps { get;...
版本: WebApiClinetCore 2.0.4 服务器相应错误的状态 403 报错时,拦截时对应 HttpRequestException.StatusCode 不是预期的 HttpStatusCode.Forbidden 值。 
多个应用,共享一套api 的TokenProvider机制。
我需要将自己声明的接口再次基于自身项目提供外部访问 目前的做法是添加API控制器配合Swagger,然后挨个暴露接口,效率实在太低了,而且需要维护多个地方 需求场景 1.上游接口不支持Swagger等在线调试时,基于上面的描述,我既声明了使用接口,也能配合swagger快速实现对上游接口的在线调试 2.接口转发,在基于上游接口的基础上扩展自己新的接口然后一并提供给下游访问