/// <summary> /// Registers a content handler to process response content /// </summary> /// <param name="contentType">MIME content type of the response content</param> /// <param name="deserializer">Deserializer to use to process content</param> public void AddHandler(string contentType, IDeserializer deserializer) { ContentHandlers[contentType] = deserializer; if (contentType != "*") { AcceptTypes.Add(contentType); } }
public void AddHandler(string contentType, IDeserializer deserializer) { ContentHandlers[contentType] = deserializer; if (contentType != "*") { AcceptTypes.Add(contentType); string value = string.Join(", ", AcceptTypes.ToArray()); this.RemoveDefaultParameter("Accept"); this.AddDefaultParameter("Accept", value, ParameterType.HttpHeader); } }
/// <summary> /// Registers a content handler to process response content /// </summary> /// <param name="contentType">MIME content type of the response content</param> /// <param name="deserializer">Deserializer to use to process content</param> public void AddHandler(string contentType, IDeserializer deserializer) { ContentHandlers[contentType] = deserializer; if (contentType != "*") { AcceptTypes.Add(contentType); // add Accept header based on registered deserializers var accepts = string.Join(", ", AcceptTypes.ToArray()); this.RemoveDefaultParameter("Accept"); this.AddDefaultParameter("Accept", accepts, ParameterType.HttpHeader); } }
public void AddHandler(string contentType, IDeserializer deserializer) { ContentHandlers[contentType] = deserializer; if (contentType == "*" || StructuredSyntaxSuffixWildcardRegex.IsMatch(contentType)) { return; } AcceptTypes.Add(contentType); var accepts = string.Join(", ", AcceptTypes); RemoveDefaultParameter("Accept"); AddDefaultParameter("Accept", accepts, ParameterType.HttpHeader); }
/// <summary> /// Registers a content handler to process response content /// </summary> /// <param name="contentType">MIME content type of the response content</param> /// <param name="deserializer">Deserializer to use to process content</param> public void AddHandler(string contentType, IDeserializer deserializer) { ContentHandlers[contentType] = deserializer; if (contentType == "*" || structuredSyntaxSuffixWildcardRegex.IsMatch(contentType)) { return; } AcceptTypes.Add(contentType); // add Accept header based on registered deserializers var accepts = string.Join(", ", AcceptTypes.ToArray()); this.RemoveDefaultParameter("Accept"); this.AddDefaultParameter("Accept", accepts, ParameterType.HttpHeader); }
/// <summary> /// Registers a content handler to process response content /// </summary> /// <param name="contentType">MIME content type of the response content</param> /// <param name="deserializerFactory">Deserializer to use to process content</param> public void AddHandler(string contentType, Func <IDeserializer> deserializerFactory) { ContentHandlers[contentType] = deserializerFactory; if (contentType == "*" || IsWildcardStructuredSuffixSyntax(contentType)) { return; } if (!AcceptTypes.Contains(contentType)) { AcceptTypes.Add(contentType); } // add Accept header based on registered deserializers var accepts = string.Join(", ", AcceptTypes.ToArray()); this.RemoveDefaultParameter("Accept"); this.AddDefaultParameter("Accept", accepts, ParameterType.HttpHeader); }