internal XboxLiveHttpRequest(XboxLiveContextSettings settings, string method, string serverName, string pathQueryFragment) { this.Method = method; this.Url = serverName + pathQueryFragment; this.contextSettings = settings; this.webRequest = (HttpWebRequest)WebRequest.Create(new Uri(this.Url)); this.webRequest.Method = method; this.SetCustomHeader("Accept-Language", CultureInfo.CurrentUICulture + "," + CultureInfo.CurrentUICulture.TwoLetterISOLanguageName); #if WINDOWS_UWP this.SetCustomHeader("Accept", "*/*"); #else this.webRequest.Accept = "*/*"; #endif this.SetCustomHeader("Cache-Control", "no-cache"); this.ContentType = "application/json; charset=utf-8"; const string userAgentType = "XboxServicesAPI"; #if !WINDOWS_UWP string userAgentVersion = typeof(XboxLiveHttpRequest).Assembly.GetName().Version.ToString(); #else string userAgentVersion = typeof(XboxLiveHttpRequest).GetTypeInfo().Assembly.GetName().Version.ToString(); #endif this.SetCustomHeader("UserAgent", userAgentType + "/" + userAgentVersion); }
public static XboxLiveHttpRequest Create(XboxLiveContextSettings settings, string httpMethod, string serverName, string pathQueryFragment) { return(XboxLiveContext.UseMockHttp ? new MockXboxLiveHttpRequest(settings, httpMethod, serverName, pathQueryFragment) : new XboxLiveHttpRequest(settings, httpMethod, serverName, pathQueryFragment)); }
public MockXboxLiveHttpRequest(XboxLiveContextSettings settings, string method, string serverName, string pathQueryFragment) : base(settings, method, serverName, pathQueryFragment) { }