pokitdokcsharp.ResponseData.init C# (CSharp) Method

init() public method

Init this instance.
public init ( ) : void
return void
        public void init()
        {
            header = new Dictionary<string, string>();
            body = "";
            status = 0;
        }

Usage Example

Beispiel #1
0
        /// <summary>
        /// Processes the http response into a <see cref="pokitdokcsharp.ResponseData"/> object.
        /// </summary>
        /// <returns>The response as a <see cref="pokitdokcsharp.ResponseData"/> object.</returns>
        /// <param name="response">Response.</param>
        private ResponseData ProcessResponse(HttpWebResponse response)
        {
            if (!(_responseData is ResponseData))
            {
                _responseData = new ResponseData();
            }
            else
            {
                _responseData.init();
            }

            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                _responseData.body = (string)sr.ReadToEnd().Trim();
            }
            foreach (string key in response.Headers.AllKeys)
            {
                _responseData.header.Add(key, response.Headers[key]);
            }
            _responseData.status      = (int)response.StatusCode;
            _responseData.status_code = (int)response.StatusCode;

            return(_responseData);
        }