22using System . Net . Http ;
33using GitVersion . OutputVariables ;
44using GitVersion . Logging ;
5- using Newtonsoft . Json ;
65using System . Text ;
76
87namespace GitVersion . BuildServers
@@ -23,12 +22,9 @@ public override string GenerateSetVersionMessage(VersionVariables variables)
2322
2423 using var httpClient = GetHttpClient ( ) ;
2524
26- var body = new
27- {
28- version = $ "{ variables . FullSemVer } .build.{ buildNumber } ",
29- } ;
25+ var body = $ "{{\" version\" :\" { variables . FullSemVer } .build.{ buildNumber } \" }}";
3026
31- var stringContent = new StringContent ( JsonConvert . SerializeObject ( body ) , Encoding . UTF8 , "application/json" ) ;
27+ var stringContent = new StringContent ( body , Encoding . UTF8 , "application/json" ) ;
3228 var response = httpClient . PutAsync ( "api/build" , stringContent ) . GetAwaiter ( ) . GetResult ( ) ;
3329 response . EnsureSuccessStatusCode ( ) ;
3430
@@ -39,13 +35,9 @@ public override string[] GenerateSetParameterMessage(string name, string value)
3935 {
4036 var httpClient = GetHttpClient ( ) ;
4137
42- var body = new
43- {
44- name = $ "GitVersion_{ name } ",
45- value = $ "{ value } "
46- } ;
38+ var body = $ "{{\" name\" : \" GitVersion_{ name } \" ,\" value\" : \" { value } \" }}";
4739
48- var stringContent = new StringContent ( JsonConvert . SerializeObject ( body ) , Encoding . UTF8 , "application/json" ) ;
40+ var stringContent = new StringContent ( body , Encoding . UTF8 , "application/json" ) ;
4941 var response = httpClient . PostAsync ( "api/build/variables" , stringContent ) . GetAwaiter ( ) . GetResult ( ) ;
5042 response . EnsureSuccessStatusCode ( ) ;
5143
0 commit comments