@@ -28,15 +28,17 @@ private VersionService() { }
2828 public static async Task Report ( string httpUrl
2929 , int recordId
3030 , int status
31- , int ? type )
31+ , int ? type
32+ , string scheme = null
33+ , string token = null )
3234 {
3335 var parameters = new Dictionary < string , object >
3436 {
3537 { "RecordId" , recordId } ,
3638 { "Status" , status } ,
3739 { "Type" , type }
3840 } ;
39- await PostTaskAsync < BaseResponseDTO < bool > > ( httpUrl , parameters , ReportRespJsonContext . Default . BaseResponseDTOBoolean ) ;
41+ await PostTaskAsync < BaseResponseDTO < bool > > ( httpUrl , parameters , ReportRespJsonContext . Default . BaseResponseDTOBoolean , scheme , token ) ;
4042 }
4143
4244 /// <summary>
@@ -54,7 +56,9 @@ public static async Task<VersionRespDTO> Validate(string httpUrl
5456 , int appType
5557 , string appKey
5658 , int platform
57- , string productId )
59+ , string productId
60+ , string scheme = null
61+ , string token = null )
5862 {
5963 var parameters = new Dictionary < string , object >
6064 {
@@ -64,10 +68,10 @@ public static async Task<VersionRespDTO> Validate(string httpUrl
6468 { "Platform" , platform } ,
6569 { "ProductId" , productId }
6670 } ;
67- return await PostTaskAsync < VersionRespDTO > ( httpUrl , parameters , VersionRespJsonContext . Default . VersionRespDTO ) ;
71+ return await PostTaskAsync < VersionRespDTO > ( httpUrl , parameters , VersionRespJsonContext . Default . VersionRespDTO , scheme , token ) ;
6872 }
6973
70- private static async Task < T > PostTaskAsync < T > ( string httpUrl , Dictionary < string , object > parameters , JsonTypeInfo < T > ? typeInfo = null )
74+ private static async Task < T > PostTaskAsync < T > ( string httpUrl , Dictionary < string , object > parameters , JsonTypeInfo < T > ? typeInfo = null , string scheme = null , string token = null )
7175 {
7276 try
7377 {
@@ -78,6 +82,13 @@ private static async Task<T> PostTaskAsync<T>(string httpUrl, Dictionary<string,
7882 } ) ;
7983 httpClient . Timeout = TimeSpan . FromSeconds ( 15 ) ;
8084 httpClient . DefaultRequestHeaders . Accept . ParseAdd ( "text/html, application/xhtml+xml, */*" ) ;
85+
86+ if ( ! string . IsNullOrEmpty ( scheme ) && ! string . IsNullOrEmpty ( token ) )
87+ {
88+ httpClient . DefaultRequestHeaders . Authorization =
89+ new System . Net . Http . Headers . AuthenticationHeaderValue ( scheme , token ) ;
90+ }
91+
8192 var parametersJson =
8293 JsonSerializer . Serialize ( parameters , HttpParameterJsonContext . Default . DictionaryStringObject ) ;
8394 var stringContent = new StringContent ( parametersJson , Encoding . UTF8 , "application/json" ) ;
0 commit comments