public HttpServices(string urlApi, MediaTypeHeader mediaType)
        {
            this.baseUrlApi      = urlApi;
            this.mediaTypeHeader = mediaType.GetDescription();

            this.HttpErrorCode = new List <string> {
                "400", "401", "403", "500"
            };
        }
예제 #2
0
        public SortedSet <MediaTypeHeader> Negotiate(String contentType)
        {
            if (contentType == null)
            {
                throw new ArgumentNullException(nameof(contentType));
            }

            return(new SortedSet <MediaTypeHeader>(contentType.Split(new[] { ',' },
                                                                     StringSplitOptions.RemoveEmptyEntries)
                                                   .Select(_ => MediaTypeHeader.Parse(_.Trim()))
                                                   .OrderByDescending(_ => _.Quality),
                                                   MediaTypeHeader.MediaTypeHeaderQualityComparer.Instance));
        }
예제 #3
0
 public HttpClientHelper()
 {
     this.mediaType = MediaTypeHeader.application_json;
 }