2
2
using System . Net . Http ;
3
3
using GitVersion . OutputVariables ;
4
4
using GitVersion . Logging ;
5
- using Newtonsoft . Json ;
6
5
using System . Text ;
7
6
8
7
namespace GitVersion . BuildServers
@@ -23,12 +22,9 @@ public override string GenerateSetVersionMessage(VersionVariables variables)
23
22
24
23
using var httpClient = GetHttpClient ( ) ;
25
24
26
- var body = new
27
- {
28
- version = $ "{ variables . FullSemVer } .build.{ buildNumber } ",
29
- } ;
25
+ var body = $ "{{\" version\" :\" { variables . FullSemVer } .build.{ buildNumber } \" }}";
30
26
31
- var stringContent = new StringContent ( JsonConvert . SerializeObject ( body ) , Encoding . UTF8 , "application/json" ) ;
27
+ var stringContent = new StringContent ( body , Encoding . UTF8 , "application/json" ) ;
32
28
var response = httpClient . PutAsync ( "api/build" , stringContent ) . GetAwaiter ( ) . GetResult ( ) ;
33
29
response . EnsureSuccessStatusCode ( ) ;
34
30
@@ -39,13 +35,9 @@ public override string[] GenerateSetParameterMessage(string name, string value)
39
35
{
40
36
var httpClient = GetHttpClient ( ) ;
41
37
42
- var body = new
43
- {
44
- name = $ "GitVersion_{ name } ",
45
- value = $ "{ value } "
46
- } ;
38
+ var body = $ "{{\" name\" : \" GitVersion_{ name } \" ,\" value\" : \" { value } \" }}";
47
39
48
- var stringContent = new StringContent ( JsonConvert . SerializeObject ( body ) , Encoding . UTF8 , "application/json" ) ;
40
+ var stringContent = new StringContent ( body , Encoding . UTF8 , "application/json" ) ;
49
41
var response = httpClient . PostAsync ( "api/build/variables" , stringContent ) . GetAwaiter ( ) . GetResult ( ) ;
50
42
response . EnsureSuccessStatusCode ( ) ;
51
43
0 commit comments