/// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpResponseMessage"/> class.
 /// </summary>
 /// <param name="responseMessage">The response message to wrap</param>
 public DefaultHttpResponseMessage([NotNull] HttpResponseMessage responseMessage)
 {
     ResponseMessage = responseMessage;
     if (responseMessage.RequestMessage != null)
         _requestMessage = new DefaultHttpRequestMessage(responseMessage.RequestMessage);
     _content = responseMessage.Content.AsRestHttpContent();
     _responseHttpHeaders = new DefaultHttpHeaders(responseMessage.Headers);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpResponseMessage"/> class.
 /// </summary>
 /// <param name="responseMessage">The response message to wrap</param>
 public DefaultHttpResponseMessage([NotNull] HttpResponseMessage responseMessage)
 {
     ResponseMessage = responseMessage;
     if (responseMessage.RequestMessage != null)
     {
         _requestMessage = new DefaultHttpRequestMessage(responseMessage.RequestMessage);
     }
     Content = responseMessage.Content.AsRestHttpContent();
     _responseHttpHeaders = new DefaultHttpHeaders(responseMessage.Headers);
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultHttpResponseMessage"/> class.
        /// </summary>
        /// <param name="requestMessage">The request message</param>
        /// <param name="responseMessage">The response message to wrap</param>
        public DefaultHttpResponseMessage([NotNull] HttpRequestMessage requestMessage, [CanBeNull] HttpResponseMessage responseMessage)
        {
            ResponseMessage = responseMessage;
            RequestMessage = new DefaultHttpRequestMessage(requestMessage);

            if (responseMessage != null)
            {
                Content = responseMessage.Content.AsRestHttpContent();
                Headers = new DefaultHttpHeaders(responseMessage.Headers);
            }
            else
            {
                Content = null;
                Headers = new Portable.Impl.GenericHttpHeaders();
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultHttpResponseMessage"/> class.
        /// </summary>
        /// <param name="requestMessage">The request message</param>
        /// <param name="responseMessage">The response message to wrap</param>
        public DefaultHttpResponseMessage([NotNull] HttpRequestMessage requestMessage, [CanBeNull] HttpResponseMessage responseMessage)
        {
            ResponseMessage = responseMessage;
            RequestMessage  = new DefaultHttpRequestMessage(requestMessage);

            if (responseMessage != null)
            {
                Content = responseMessage.Content.AsRestHttpContent();
                Headers = new DefaultHttpHeaders(responseMessage.Headers);
            }
            else
            {
                Content = null;
                Headers = new Portable.Impl.GenericHttpHeaders();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpClient"/> class.
 /// </summary>
 /// <param name="client">The <see cref="HttpClient"/> to wrap.</param>
 public DefaultHttpClient([NotNull] System.Net.Http.HttpClient client)
 {
     Client = client;
     _defaultHeaders = new DefaultHttpHeaders(client.DefaultRequestHeaders);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpRequestMessage"/> class.
 /// </summary>
 /// <param name="requestMessage">The request message to wrap</param>
 public DefaultHttpRequestMessage([NotNull] HttpRequestMessage requestMessage)
 {
     RequestMessage = requestMessage;
     _requestHttpHeaders = new DefaultHttpHeaders(requestMessage.Headers);
     _content = requestMessage.Content.AsRestHttpContent();
 }
Пример #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpClient"/> class.
 /// </summary>
 /// <param name="client">The <see cref="HttpClient"/> to wrap.</param>
 public DefaultHttpClient([NotNull] System.Net.Http.HttpClient client)
 {
     Client          = client;
     _defaultHeaders = new DefaultHttpHeaders(client.DefaultRequestHeaders);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpRequestMessage"/> class.
 /// </summary>
 /// <param name="requestMessage">The request message to wrap</param>
 public DefaultHttpRequestMessage([NotNull] HttpRequestMessage requestMessage)
 {
     RequestMessage      = requestMessage;
     _requestHttpHeaders = new DefaultHttpHeaders(requestMessage.Headers);
     _content            = requestMessage.Content.AsRestHttpContent();
 }
Пример #9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DefaultHttpClient"/> class.
 /// </summary>
 /// <param name="client">The <see cref="HttpClient"/> to wrap.</param>
 /// <param name="cookies">A container of cookies</param>
 public DefaultHttpClient([NotNull] System.Net.Http.HttpClient client, [CanBeNull] CookieContainer cookies)
 {
     _cookies        = cookies;
     Client          = client;
     _defaultHeaders = new DefaultHttpHeaders(client.DefaultRequestHeaders);
 }