protected TResult Put <TResult>(string uri, object value) { using (HttpContent httpContent = new ObjectStringContent(value)) { HttpResponseMessage response = PutMessage(_httpClient, BuildUri(uri), value); return(GetResult <TResult>(response)); } }
protected async Task <TResult> PutAsync <TResult>(string uri, object value) { using (HttpContent httpContent = new ObjectStringContent(value)) { HttpResponseMessage response = await PutMessageAsync(_httpClient, BuildUri(uri), value); return(await GetResultAsync <TResult>(response)); } }
public override HttpContent GetHttpContent(MediaTypeHeaderValue contentType, IFeignOptions options) { Type type = typeof(T); if (type == typeof(byte[]) || typeof(Stream).IsAssignableFrom(type)) { //throw new NotSupportedException($"不支持{type.FullName}类型的参数"); return(null); } if (contentType == null) { return(new ObjectStringContent(Content, Encoding.UTF8, "application/json", options.JsonProvider)); } ObjectStringContent content = new ObjectStringContent(Content, options.JsonProvider); content.Headers.ContentType = contentType; return(content); }