/// <summary> /// Produce a header collection /// </summary> /// <param name="msg"></param> /// <param name="headers"></param> protected virtual void Headers(HttpRequestMessage msg, Params headers = null) { if (null == headers) { return; } Rfc2616.Populate(msg, headers); }
/// <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 ContentDispositionHeaderValue Disposition(ParameterInfo x) { var p = x.GetAttributeValue((DispositionAttribute y) => y.Value).FirstOrDefault(); return(Rfc2616.Disposition(p)); }
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))); }