示例#1
0
        /// <summary>
        ///  send the request
        /// </summary>
        /// <typeparam name="T">the response the request return</typeparam>
        /// <param name="httpRequest">the request you want to send</param>
        /// <returns></returns>
        public T SendRequest <T>(AbstractRequest <T> httpRequest) where T : BaseResponse
        {
            auth.GetTokenAndProjectId(out string projectId, out string authToken);
            AddCommonHeaders(httpRequest, authToken, projectId);
            httpRequest.SmnConfiguration    = smnConfiguration;
            httpRequest.ClientConfiguration = clientConfiguration;
            httpRequest.ProjectId           = projectId;
            HttpWebResponse response = HttpTool.GetHttpResponse(httpRequest, this.clientConfiguration);

            if (HttpTool.IsNoPermission(response))
            {
                // if no permission to clear the cache
                CleanToken();
            }
            return(httpRequest.GetResponse(response));
        }