/// <summary> /// Send an object /// </summary> /// <typeparam name="T"></typeparam> /// <param name="method"></param> /// <param name="template"></param> /// <param name="parameters"></param> /// <param name="body"></param> /// <param name="headers"></param> /// <param name="token"></param> /// <returns></returns> public virtual Task <HttpResponseMessage> SendAsync <T>(HttpMethod method, string template, Params parameters = null, T?body = null, Params headers = null, Token?token = null) where T : struct { var type = Rfc2616.ContentType(headers); var content = ContentBuilder().Struct(body).ContentType(type).Build(); return(SendAsync(method, template, parameters, headers, content, token)); }
protected virtual MediaTypeHeaderValue ContentType(ParameterInfo x) { var p = x.GetAttributeValue((TypeAttribute y) => y.Value).FirstOrDefault(); return(Rfc2616.ContentType(p)); }
public static IContentBuilder ContentType(this IContentBuilder @this, string header) { return(@this.ContentType(Rfc2616.ContentType(header))); }