예제 #1
0
        private IResponseDeserializationStrategy FindValidDeserializer(IDeserializationStrategyFactory deserializationFactory, HttpResponseMessage response)
        {
            if (deserializationFactory == null)
            {
                throw new ArgumentNullException(nameof(deserializationFactory));
            }
            if (response == null)
            {
                throw new ArgumentNullException(nameof(response));
            }

            //We must try to find a serializer based on the content type header in the response
            return(deserializationFactory.DeserializerFor(response.Content.Headers.ContentType.MediaType));
        }
예제 #2
0
        private IResponseDeserializationStrategy FindValidDeserializer(IDeserializationStrategyFactory deserializationFactory, IRestResponse response)
        {
            if (deserializationFactory == null)
            {
                throw new ArgumentNullException(nameof(deserializationFactory));
            }
            if (response == null)
            {
                throw new ArgumentNullException(nameof(response));
            }

            //TODO: Restsharp doesn't split up content type and encoding. We need to maybe step through each value.
            //We must try to find a serializer based on the content type header in the response
            return(deserializationFactory.DeserializerFor(response.ContentType.Split(';').FirstOrDefault()));
        }