@azure-typespec/http-client-csharp 1.0.0-alpha.20260821.3 → 1.0.0-alpha.20260824.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,10 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260821.3": {
9
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260824.2": {
10
10
  "dependencies": {
11
- "Azure.Generator": "1.0.0-alpha.20260821.3",
12
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2",
11
+ "Azure.Generator": "1.0.0-alpha.20260824.2",
12
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4",
13
13
  "System.ClientModel": "1.15.0"
14
14
  },
15
15
  "runtime": {
@@ -439,12 +439,12 @@
439
439
  }
440
440
  }
441
441
  },
442
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
442
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
443
443
  "dependencies": {
444
444
  "CommandLineParser": "2.9.1",
445
445
  "Microsoft.Build": "17.9.5",
446
446
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
447
- "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260821.2",
447
+ "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260824.4",
448
448
  "NuGet.Configuration": "6.14.3",
449
449
  "NuGet.Protocol": "6.14.3",
450
450
  "NuGet.Versioning": "6.14.3",
@@ -458,10 +458,10 @@
458
458
  }
459
459
  }
460
460
  },
461
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
461
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
462
462
  "dependencies": {
463
463
  "Microsoft.Extensions.Configuration.Abstractions": "10.0.10",
464
- "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260821.2",
464
+ "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260824.4",
465
465
  "System.ClientModel": "1.15.0"
466
466
  },
467
467
  "runtime": {
@@ -471,7 +471,7 @@
471
471
  }
472
472
  }
473
473
  },
474
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
474
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
475
475
  "dependencies": {
476
476
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
477
477
  "System.Memory.Data": "10.0.10"
@@ -711,24 +711,24 @@
711
711
  }
712
712
  }
713
713
  },
714
- "Azure.Generator/1.0.0-alpha.20260821.3": {
714
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
715
715
  "dependencies": {
716
716
  "Azure.Core": "1.62.0",
717
717
  "Azure.Core.Expressions.DataFactory": "1.0.0",
718
718
  "Azure.ResourceManager": "1.14.0",
719
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2"
719
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4"
720
720
  },
721
721
  "runtime": {
722
722
  "Azure.Generator.dll": {
723
723
  "assemblyVersion": "1.0.0.0",
724
- "fileVersion": "1.0.26.42103"
724
+ "fileVersion": "1.0.26.42402"
725
725
  }
726
726
  }
727
727
  }
728
728
  }
729
729
  },
730
730
  "libraries": {
731
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260821.3": {
731
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260824.2": {
732
732
  "type": "project",
733
733
  "serviceable": false,
734
734
  "sha512": ""
@@ -901,26 +901,26 @@
901
901
  "path": "microsoft.net.stringtools/17.9.5",
902
902
  "hashPath": "microsoft.net.stringtools.17.9.5.nupkg.sha512"
903
903
  },
904
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
904
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
905
905
  "type": "package",
906
906
  "serviceable": true,
907
- "sha512": "sha512-qlfcelmRdqqI8R+p6lLhTFzlmP1adNAIbIlcTfbE8SYenVFyR/1zLt8L4GWFY8UQo/dJ5h0l156QPMlSOABNqw==",
908
- "path": "microsoft.typespec.generator/1.0.0-alpha.20260821.2",
909
- "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260821.2.nupkg.sha512"
907
+ "sha512": "sha512-cNCW+KzLYTiXzJzFhh/9aumR/v9LOPr2evXlEWYIS01mAG9nIVzUeLiL87Or0VxuYZKYMxNVqWOBtkZUHBKD2w==",
908
+ "path": "microsoft.typespec.generator/1.0.0-alpha.20260824.4",
909
+ "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260824.4.nupkg.sha512"
910
910
  },
911
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
911
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
912
912
  "type": "package",
913
913
  "serviceable": true,
914
- "sha512": "sha512-8uZI31xL6HvtJ3cqnPdgjY3mecGJcjDrtALTvanGmJR7hvqRwli1re6eF8kLs4o3bQ39/6kb9Di1UyjQD4FmeA==",
915
- "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260821.2",
916
- "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260821.2.nupkg.sha512"
914
+ "sha512": "sha512-JfagyxA7sMJzUn54vQux9NDt598lx89m8bhH4m14ItpweUzg4NhBoi3cafP37OVVrQIzwj8JWQkTpHWW6RB+9w==",
915
+ "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260824.4",
916
+ "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260824.4.nupkg.sha512"
917
917
  },
918
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
918
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
919
919
  "type": "package",
920
920
  "serviceable": true,
921
- "sha512": "sha512-ZAelzHCMUF6YchikA/uGiZbiDIR8Suro/EwaRF7NRVDqpQoGVM5K6H3NLFu3cqkwLIzeua+isFsxFAiZcApGJA==",
922
- "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260821.2",
923
- "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260821.2.nupkg.sha512"
921
+ "sha512": "sha512-U9dKRMkeY1XY094vbUND5kTaKr+CKASAJj5bc8TLrodN88a1Bz98I91T5JupeBaohDWgdCWcTdiyKXRy9ft0XA==",
922
+ "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260824.4",
923
+ "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260824.4.nupkg.sha512"
924
924
  },
925
925
  "Newtonsoft.Json/13.0.3": {
926
926
  "type": "package",
@@ -1069,7 +1069,7 @@
1069
1069
  "path": "system.security.cryptography.protecteddata/8.0.0",
1070
1070
  "hashPath": "system.security.cryptography.protecteddata.8.0.0.nupkg.sha512"
1071
1071
  },
1072
- "Azure.Generator/1.0.0-alpha.20260821.3": {
1072
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
1073
1073
  "type": "project",
1074
1074
  "serviceable": false,
1075
1075
  "sha512": ""
@@ -6,12 +6,12 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator/1.0.0-alpha.20260821.3": {
9
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
10
10
  "dependencies": {
11
11
  "Azure.Core": "1.62.0",
12
12
  "Azure.Core.Expressions.DataFactory": "1.0.0",
13
13
  "Azure.ResourceManager": "1.14.0",
14
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2"
14
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4"
15
15
  },
16
16
  "runtime": {
17
17
  "Azure.Generator.dll": {}
@@ -440,12 +440,12 @@
440
440
  }
441
441
  }
442
442
  },
443
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
443
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
444
444
  "dependencies": {
445
445
  "CommandLineParser": "2.9.1",
446
446
  "Microsoft.Build": "17.9.5",
447
447
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
448
- "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260821.2",
448
+ "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260824.4",
449
449
  "NuGet.Configuration": "6.14.3",
450
450
  "NuGet.Protocol": "6.14.3",
451
451
  "NuGet.Versioning": "6.14.3",
@@ -459,10 +459,10 @@
459
459
  }
460
460
  }
461
461
  },
462
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
462
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
463
463
  "dependencies": {
464
464
  "Microsoft.Extensions.Configuration.Abstractions": "10.0.10",
465
- "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260821.2",
465
+ "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260824.4",
466
466
  "System.ClientModel": "1.15.0"
467
467
  },
468
468
  "runtime": {
@@ -472,7 +472,7 @@
472
472
  }
473
473
  }
474
474
  },
475
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
475
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
476
476
  "dependencies": {
477
477
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
478
478
  "System.Memory.Data": "10.0.10"
@@ -715,7 +715,7 @@
715
715
  }
716
716
  },
717
717
  "libraries": {
718
- "Azure.Generator/1.0.0-alpha.20260821.3": {
718
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
719
719
  "type": "project",
720
720
  "serviceable": false,
721
721
  "sha512": ""
@@ -888,26 +888,26 @@
888
888
  "path": "microsoft.net.stringtools/17.9.5",
889
889
  "hashPath": "microsoft.net.stringtools.17.9.5.nupkg.sha512"
890
890
  },
891
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
891
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
892
892
  "type": "package",
893
893
  "serviceable": true,
894
- "sha512": "sha512-qlfcelmRdqqI8R+p6lLhTFzlmP1adNAIbIlcTfbE8SYenVFyR/1zLt8L4GWFY8UQo/dJ5h0l156QPMlSOABNqw==",
895
- "path": "microsoft.typespec.generator/1.0.0-alpha.20260821.2",
896
- "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260821.2.nupkg.sha512"
894
+ "sha512": "sha512-cNCW+KzLYTiXzJzFhh/9aumR/v9LOPr2evXlEWYIS01mAG9nIVzUeLiL87Or0VxuYZKYMxNVqWOBtkZUHBKD2w==",
895
+ "path": "microsoft.typespec.generator/1.0.0-alpha.20260824.4",
896
+ "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260824.4.nupkg.sha512"
897
897
  },
898
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
898
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
899
899
  "type": "package",
900
900
  "serviceable": true,
901
- "sha512": "sha512-8uZI31xL6HvtJ3cqnPdgjY3mecGJcjDrtALTvanGmJR7hvqRwli1re6eF8kLs4o3bQ39/6kb9Di1UyjQD4FmeA==",
902
- "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260821.2",
903
- "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260821.2.nupkg.sha512"
901
+ "sha512": "sha512-JfagyxA7sMJzUn54vQux9NDt598lx89m8bhH4m14ItpweUzg4NhBoi3cafP37OVVrQIzwj8JWQkTpHWW6RB+9w==",
902
+ "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260824.4",
903
+ "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260824.4.nupkg.sha512"
904
904
  },
905
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
905
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
906
906
  "type": "package",
907
907
  "serviceable": true,
908
- "sha512": "sha512-ZAelzHCMUF6YchikA/uGiZbiDIR8Suro/EwaRF7NRVDqpQoGVM5K6H3NLFu3cqkwLIzeua+isFsxFAiZcApGJA==",
909
- "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260821.2",
910
- "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260821.2.nupkg.sha512"
908
+ "sha512": "sha512-U9dKRMkeY1XY094vbUND5kTaKr+CKASAJj5bc8TLrodN88a1Bz98I91T5JupeBaohDWgdCWcTdiyKXRy9ft0XA==",
909
+ "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260824.4",
910
+ "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260824.4.nupkg.sha512"
911
911
  },
912
912
  "Newtonsoft.Json/13.0.3": {
913
913
  "type": "package",
Binary file
Binary file
@@ -14,32 +14,55 @@ namespace Azure.Core
14
14
  {
15
15
  internal sealed class AzurePipelineResponse : PipelineResponse
16
16
  {
17
- private readonly Response _response;
18
17
  private readonly PipelineResponseHeaders _headers;
18
+ private readonly int _status;
19
+ private readonly string _reasonPhrase;
20
+ private Stream? _contentStream;
19
21
 
20
- internal AzurePipelineResponse(Response response)
22
+ internal AzurePipelineResponse(HttpMessage message)
21
23
  {
22
- _response = response;
24
+ Response response = message.Response;
23
25
  _headers = new AzurePipelineResponseHeaders(response.Headers);
26
+ _status = response.Status;
27
+ _reasonPhrase = response.ReasonPhrase;
28
+ _contentStream = message.ExtractResponseContent();
24
29
  }
25
30
 
26
- public override int Status => _response.Status;
31
+ public override int Status => _status;
27
32
 
28
- public override string ReasonPhrase => _response.ReasonPhrase;
33
+ public override string ReasonPhrase => _reasonPhrase;
29
34
 
30
35
  protected override PipelineResponseHeaders HeadersCore => _headers;
31
36
 
32
37
  public override Stream? ContentStream
33
38
  {
34
- get => _response.ContentStream;
35
- set => _response.ContentStream = value;
39
+ get => _contentStream;
40
+ set => _contentStream = value;
36
41
  }
37
42
 
38
- public override BinaryData Content => _response.Content;
43
+ public override BinaryData Content
44
+ {
45
+ get
46
+ {
47
+ if (_contentStream is null)
48
+ {
49
+ return BinaryData.Empty;
50
+ }
51
+
52
+ if (_contentStream is not MemoryStream content)
53
+ {
54
+ throw new InvalidOperationException("The response is not buffered.");
55
+ }
56
+
57
+ return content.TryGetBuffer(out ArraySegment<byte> segment)
58
+ ? new BinaryData(segment.AsMemory())
59
+ : new BinaryData(content.ToArray());
60
+ }
61
+ }
39
62
 
40
63
  public override BinaryData BufferContent(CancellationToken cancellationToken = default)
41
64
  {
42
- Stream? responseContentStream = _response.ContentStream;
65
+ Stream? responseContentStream = ContentStream;
43
66
  if (responseContentStream is not MemoryStream)
44
67
  {
45
68
  var content = new MemoryStream();
@@ -51,7 +74,7 @@ namespace Azure.Core
51
74
  }
52
75
  content.Position = 0;
53
76
  responseContentStream?.Dispose();
54
- _response.ContentStream = content;
77
+ ContentStream = content;
55
78
  }
56
79
  catch
57
80
  {
@@ -60,12 +83,12 @@ namespace Azure.Core
60
83
  }
61
84
  }
62
85
 
63
- return _response.Content;
86
+ return Content;
64
87
  }
65
88
 
66
89
  public override async ValueTask<BinaryData> BufferContentAsync(CancellationToken cancellationToken = default)
67
90
  {
68
- Stream? responseContentStream = _response.ContentStream;
91
+ Stream? responseContentStream = ContentStream;
69
92
  if (responseContentStream is not MemoryStream)
70
93
  {
71
94
  var content = new MemoryStream();
@@ -77,7 +100,7 @@ namespace Azure.Core
77
100
  }
78
101
  content.Position = 0;
79
102
  responseContentStream?.Dispose();
80
- _response.ContentStream = content;
103
+ ContentStream = content;
81
104
  }
82
105
  catch
83
106
  {
@@ -86,10 +109,14 @@ namespace Azure.Core
86
109
  }
87
110
  }
88
111
 
89
- return _response.Content;
112
+ return Content;
90
113
  }
91
114
 
92
- public override void Dispose() => _response.Dispose();
115
+ public override void Dispose()
116
+ {
117
+ _contentStream?.Dispose();
118
+ _contentStream = null;
119
+ }
93
120
 
94
121
  private static void CopyTo(Stream source, Stream destination, CancellationToken cancellationToken)
95
122
  {
@@ -109,24 +136,41 @@ namespace Azure.Core
109
136
 
110
137
  private sealed class AzurePipelineResponseHeaders : PipelineResponseHeaders
111
138
  {
112
- private readonly ResponseHeaders _headers;
139
+ private readonly Dictionary<string, string> _headerValues;
140
+ private readonly Dictionary<string, IEnumerable<string>> _headerValueCollections;
141
+ private readonly List<KeyValuePair<string, string>> _headerList;
113
142
 
114
143
  internal AzurePipelineResponseHeaders(ResponseHeaders headers)
115
144
  {
116
- _headers = headers;
145
+ _headerValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
146
+ _headerValueCollections = new Dictionary<string, IEnumerable<string>>(StringComparer.OrdinalIgnoreCase);
147
+ _headerList = new List<KeyValuePair<string, string>>();
148
+ foreach (HttpHeader header in headers)
149
+ {
150
+ if (!_headerValues.ContainsKey(header.Name))
151
+ {
152
+ _headerValues.Add(header.Name, header.Value);
153
+ }
154
+ if (!_headerValueCollections.ContainsKey(header.Name)
155
+ && headers.TryGetValues(header.Name, out IEnumerable<string>? values))
156
+ {
157
+ _headerValueCollections.Add(header.Name, new List<string>(values));
158
+ }
159
+ _headerList.Add(new KeyValuePair<string, string>(header.Name, header.Value));
160
+ }
117
161
  }
118
162
 
119
163
  public override bool TryGetValue(string name, out string? value)
120
- => _headers.TryGetValue(name, out value);
164
+ => _headerValues.TryGetValue(name, out value);
121
165
 
122
166
  public override bool TryGetValues(string name, out IEnumerable<string>? values)
123
- => _headers.TryGetValues(name, out values);
167
+ => _headerValueCollections.TryGetValue(name, out values);
124
168
 
125
169
  public override IEnumerator<KeyValuePair<string, string>> GetEnumerator()
126
170
  {
127
- foreach (HttpHeader header in _headers)
171
+ foreach (KeyValuePair<string, string> header in _headerList)
128
172
  {
129
- yield return new KeyValuePair<string, string>(header.Name, header.Value);
173
+ yield return header;
130
174
  }
131
175
  }
132
176
  }
@@ -6,10 +6,10 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260821.3": {
9
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260824.2": {
10
10
  "dependencies": {
11
- "Azure.Generator": "1.0.0-alpha.20260821.3",
12
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2",
11
+ "Azure.Generator": "1.0.0-alpha.20260824.2",
12
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4",
13
13
  "System.ClientModel": "1.15.0"
14
14
  },
15
15
  "runtime": {
@@ -439,12 +439,12 @@
439
439
  }
440
440
  }
441
441
  },
442
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
442
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
443
443
  "dependencies": {
444
444
  "CommandLineParser": "2.9.1",
445
445
  "Microsoft.Build": "17.9.5",
446
446
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
447
- "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260821.2",
447
+ "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260824.4",
448
448
  "NuGet.Configuration": "6.14.3",
449
449
  "NuGet.Protocol": "6.14.3",
450
450
  "NuGet.Versioning": "6.14.3",
@@ -458,10 +458,10 @@
458
458
  }
459
459
  }
460
460
  },
461
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
461
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
462
462
  "dependencies": {
463
463
  "Microsoft.Extensions.Configuration.Abstractions": "10.0.10",
464
- "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260821.2",
464
+ "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260824.4",
465
465
  "System.ClientModel": "1.15.0"
466
466
  },
467
467
  "runtime": {
@@ -471,7 +471,7 @@
471
471
  }
472
472
  }
473
473
  },
474
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
474
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
475
475
  "dependencies": {
476
476
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
477
477
  "System.Memory.Data": "10.0.10"
@@ -711,24 +711,24 @@
711
711
  }
712
712
  }
713
713
  },
714
- "Azure.Generator/1.0.0-alpha.20260821.3": {
714
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
715
715
  "dependencies": {
716
716
  "Azure.Core": "1.62.0",
717
717
  "Azure.Core.Expressions.DataFactory": "1.0.0",
718
718
  "Azure.ResourceManager": "1.14.0",
719
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2"
719
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4"
720
720
  },
721
721
  "runtime": {
722
722
  "Azure.Generator.dll": {
723
723
  "assemblyVersion": "1.0.0.0",
724
- "fileVersion": "1.0.26.42103"
724
+ "fileVersion": "1.0.26.42402"
725
725
  }
726
726
  }
727
727
  }
728
728
  }
729
729
  },
730
730
  "libraries": {
731
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260821.3": {
731
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260824.2": {
732
732
  "type": "project",
733
733
  "serviceable": false,
734
734
  "sha512": ""
@@ -901,26 +901,26 @@
901
901
  "path": "microsoft.net.stringtools/17.9.5",
902
902
  "hashPath": "microsoft.net.stringtools.17.9.5.nupkg.sha512"
903
903
  },
904
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
904
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
905
905
  "type": "package",
906
906
  "serviceable": true,
907
- "sha512": "sha512-qlfcelmRdqqI8R+p6lLhTFzlmP1adNAIbIlcTfbE8SYenVFyR/1zLt8L4GWFY8UQo/dJ5h0l156QPMlSOABNqw==",
908
- "path": "microsoft.typespec.generator/1.0.0-alpha.20260821.2",
909
- "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260821.2.nupkg.sha512"
907
+ "sha512": "sha512-cNCW+KzLYTiXzJzFhh/9aumR/v9LOPr2evXlEWYIS01mAG9nIVzUeLiL87Or0VxuYZKYMxNVqWOBtkZUHBKD2w==",
908
+ "path": "microsoft.typespec.generator/1.0.0-alpha.20260824.4",
909
+ "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260824.4.nupkg.sha512"
910
910
  },
911
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
911
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
912
912
  "type": "package",
913
913
  "serviceable": true,
914
- "sha512": "sha512-8uZI31xL6HvtJ3cqnPdgjY3mecGJcjDrtALTvanGmJR7hvqRwli1re6eF8kLs4o3bQ39/6kb9Di1UyjQD4FmeA==",
915
- "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260821.2",
916
- "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260821.2.nupkg.sha512"
914
+ "sha512": "sha512-JfagyxA7sMJzUn54vQux9NDt598lx89m8bhH4m14ItpweUzg4NhBoi3cafP37OVVrQIzwj8JWQkTpHWW6RB+9w==",
915
+ "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260824.4",
916
+ "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260824.4.nupkg.sha512"
917
917
  },
918
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
918
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
919
919
  "type": "package",
920
920
  "serviceable": true,
921
- "sha512": "sha512-ZAelzHCMUF6YchikA/uGiZbiDIR8Suro/EwaRF7NRVDqpQoGVM5K6H3NLFu3cqkwLIzeua+isFsxFAiZcApGJA==",
922
- "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260821.2",
923
- "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260821.2.nupkg.sha512"
921
+ "sha512": "sha512-U9dKRMkeY1XY094vbUND5kTaKr+CKASAJj5bc8TLrodN88a1Bz98I91T5JupeBaohDWgdCWcTdiyKXRy9ft0XA==",
922
+ "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260824.4",
923
+ "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260824.4.nupkg.sha512"
924
924
  },
925
925
  "Newtonsoft.Json/13.0.3": {
926
926
  "type": "package",
@@ -1069,7 +1069,7 @@
1069
1069
  "path": "system.security.cryptography.protecteddata/8.0.0",
1070
1070
  "hashPath": "system.security.cryptography.protecteddata.8.0.0.nupkg.sha512"
1071
1071
  },
1072
- "Azure.Generator/1.0.0-alpha.20260821.3": {
1072
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
1073
1073
  "type": "project",
1074
1074
  "serviceable": false,
1075
1075
  "sha512": ""
@@ -6,12 +6,12 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator/1.0.0-alpha.20260821.3": {
9
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
10
10
  "dependencies": {
11
11
  "Azure.Core": "1.62.0",
12
12
  "Azure.Core.Expressions.DataFactory": "1.0.0",
13
13
  "Azure.ResourceManager": "1.14.0",
14
- "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260821.2"
14
+ "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260824.4"
15
15
  },
16
16
  "runtime": {
17
17
  "Azure.Generator.dll": {}
@@ -440,12 +440,12 @@
440
440
  }
441
441
  }
442
442
  },
443
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
443
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
444
444
  "dependencies": {
445
445
  "CommandLineParser": "2.9.1",
446
446
  "Microsoft.Build": "17.9.5",
447
447
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
448
- "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260821.2",
448
+ "Microsoft.TypeSpec.Generator.Input": "1.0.0-alpha.20260824.4",
449
449
  "NuGet.Configuration": "6.14.3",
450
450
  "NuGet.Protocol": "6.14.3",
451
451
  "NuGet.Versioning": "6.14.3",
@@ -459,10 +459,10 @@
459
459
  }
460
460
  }
461
461
  },
462
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
462
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
463
463
  "dependencies": {
464
464
  "Microsoft.Extensions.Configuration.Abstractions": "10.0.10",
465
- "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260821.2",
465
+ "Microsoft.TypeSpec.Generator": "1.0.0-alpha.20260824.4",
466
466
  "System.ClientModel": "1.15.0"
467
467
  },
468
468
  "runtime": {
@@ -472,7 +472,7 @@
472
472
  }
473
473
  }
474
474
  },
475
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
475
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
476
476
  "dependencies": {
477
477
  "Microsoft.CodeAnalysis.CSharp.Workspaces": "4.8.0",
478
478
  "System.Memory.Data": "10.0.10"
@@ -715,7 +715,7 @@
715
715
  }
716
716
  },
717
717
  "libraries": {
718
- "Azure.Generator/1.0.0-alpha.20260821.3": {
718
+ "Azure.Generator/1.0.0-alpha.20260824.2": {
719
719
  "type": "project",
720
720
  "serviceable": false,
721
721
  "sha512": ""
@@ -888,26 +888,26 @@
888
888
  "path": "microsoft.net.stringtools/17.9.5",
889
889
  "hashPath": "microsoft.net.stringtools.17.9.5.nupkg.sha512"
890
890
  },
891
- "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260821.2": {
891
+ "Microsoft.TypeSpec.Generator/1.0.0-alpha.20260824.4": {
892
892
  "type": "package",
893
893
  "serviceable": true,
894
- "sha512": "sha512-qlfcelmRdqqI8R+p6lLhTFzlmP1adNAIbIlcTfbE8SYenVFyR/1zLt8L4GWFY8UQo/dJ5h0l156QPMlSOABNqw==",
895
- "path": "microsoft.typespec.generator/1.0.0-alpha.20260821.2",
896
- "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260821.2.nupkg.sha512"
894
+ "sha512": "sha512-cNCW+KzLYTiXzJzFhh/9aumR/v9LOPr2evXlEWYIS01mAG9nIVzUeLiL87Or0VxuYZKYMxNVqWOBtkZUHBKD2w==",
895
+ "path": "microsoft.typespec.generator/1.0.0-alpha.20260824.4",
896
+ "hashPath": "microsoft.typespec.generator.1.0.0-alpha.20260824.4.nupkg.sha512"
897
897
  },
898
- "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260821.2": {
898
+ "Microsoft.TypeSpec.Generator.ClientModel/1.0.0-alpha.20260824.4": {
899
899
  "type": "package",
900
900
  "serviceable": true,
901
- "sha512": "sha512-8uZI31xL6HvtJ3cqnPdgjY3mecGJcjDrtALTvanGmJR7hvqRwli1re6eF8kLs4o3bQ39/6kb9Di1UyjQD4FmeA==",
902
- "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260821.2",
903
- "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260821.2.nupkg.sha512"
901
+ "sha512": "sha512-JfagyxA7sMJzUn54vQux9NDt598lx89m8bhH4m14ItpweUzg4NhBoi3cafP37OVVrQIzwj8JWQkTpHWW6RB+9w==",
902
+ "path": "microsoft.typespec.generator.clientmodel/1.0.0-alpha.20260824.4",
903
+ "hashPath": "microsoft.typespec.generator.clientmodel.1.0.0-alpha.20260824.4.nupkg.sha512"
904
904
  },
905
- "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260821.2": {
905
+ "Microsoft.TypeSpec.Generator.Input/1.0.0-alpha.20260824.4": {
906
906
  "type": "package",
907
907
  "serviceable": true,
908
- "sha512": "sha512-ZAelzHCMUF6YchikA/uGiZbiDIR8Suro/EwaRF7NRVDqpQoGVM5K6H3NLFu3cqkwLIzeua+isFsxFAiZcApGJA==",
909
- "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260821.2",
910
- "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260821.2.nupkg.sha512"
908
+ "sha512": "sha512-U9dKRMkeY1XY094vbUND5kTaKr+CKASAJj5bc8TLrodN88a1Bz98I91T5JupeBaohDWgdCWcTdiyKXRy9ft0XA==",
909
+ "path": "microsoft.typespec.generator.input/1.0.0-alpha.20260824.4",
910
+ "hashPath": "microsoft.typespec.generator.input.1.0.0-alpha.20260824.4.nupkg.sha512"
911
911
  },
912
912
  "Newtonsoft.Json/13.0.3": {
913
913
  "type": "package",
@@ -14,32 +14,55 @@ namespace Azure.Core
14
14
  {
15
15
  internal sealed class AzurePipelineResponse : PipelineResponse
16
16
  {
17
- private readonly Response _response;
18
17
  private readonly PipelineResponseHeaders _headers;
18
+ private readonly int _status;
19
+ private readonly string _reasonPhrase;
20
+ private Stream? _contentStream;
19
21
 
20
- internal AzurePipelineResponse(Response response)
22
+ internal AzurePipelineResponse(HttpMessage message)
21
23
  {
22
- _response = response;
24
+ Response response = message.Response;
23
25
  _headers = new AzurePipelineResponseHeaders(response.Headers);
26
+ _status = response.Status;
27
+ _reasonPhrase = response.ReasonPhrase;
28
+ _contentStream = message.ExtractResponseContent();
24
29
  }
25
30
 
26
- public override int Status => _response.Status;
31
+ public override int Status => _status;
27
32
 
28
- public override string ReasonPhrase => _response.ReasonPhrase;
33
+ public override string ReasonPhrase => _reasonPhrase;
29
34
 
30
35
  protected override PipelineResponseHeaders HeadersCore => _headers;
31
36
 
32
37
  public override Stream? ContentStream
33
38
  {
34
- get => _response.ContentStream;
35
- set => _response.ContentStream = value;
39
+ get => _contentStream;
40
+ set => _contentStream = value;
36
41
  }
37
42
 
38
- public override BinaryData Content => _response.Content;
43
+ public override BinaryData Content
44
+ {
45
+ get
46
+ {
47
+ if (_contentStream is null)
48
+ {
49
+ return BinaryData.Empty;
50
+ }
51
+
52
+ if (_contentStream is not MemoryStream content)
53
+ {
54
+ throw new InvalidOperationException("The response is not buffered.");
55
+ }
56
+
57
+ return content.TryGetBuffer(out ArraySegment<byte> segment)
58
+ ? new BinaryData(segment.AsMemory())
59
+ : new BinaryData(content.ToArray());
60
+ }
61
+ }
39
62
 
40
63
  public override BinaryData BufferContent(CancellationToken cancellationToken = default)
41
64
  {
42
- Stream? responseContentStream = _response.ContentStream;
65
+ Stream? responseContentStream = ContentStream;
43
66
  if (responseContentStream is not MemoryStream)
44
67
  {
45
68
  var content = new MemoryStream();
@@ -51,7 +74,7 @@ namespace Azure.Core
51
74
  }
52
75
  content.Position = 0;
53
76
  responseContentStream?.Dispose();
54
- _response.ContentStream = content;
77
+ ContentStream = content;
55
78
  }
56
79
  catch
57
80
  {
@@ -60,12 +83,12 @@ namespace Azure.Core
60
83
  }
61
84
  }
62
85
 
63
- return _response.Content;
86
+ return Content;
64
87
  }
65
88
 
66
89
  public override async ValueTask<BinaryData> BufferContentAsync(CancellationToken cancellationToken = default)
67
90
  {
68
- Stream? responseContentStream = _response.ContentStream;
91
+ Stream? responseContentStream = ContentStream;
69
92
  if (responseContentStream is not MemoryStream)
70
93
  {
71
94
  var content = new MemoryStream();
@@ -77,7 +100,7 @@ namespace Azure.Core
77
100
  }
78
101
  content.Position = 0;
79
102
  responseContentStream?.Dispose();
80
- _response.ContentStream = content;
103
+ ContentStream = content;
81
104
  }
82
105
  catch
83
106
  {
@@ -86,10 +109,14 @@ namespace Azure.Core
86
109
  }
87
110
  }
88
111
 
89
- return _response.Content;
112
+ return Content;
90
113
  }
91
114
 
92
- public override void Dispose() => _response.Dispose();
115
+ public override void Dispose()
116
+ {
117
+ _contentStream?.Dispose();
118
+ _contentStream = null;
119
+ }
93
120
 
94
121
  private static void CopyTo(Stream source, Stream destination, CancellationToken cancellationToken)
95
122
  {
@@ -109,24 +136,41 @@ namespace Azure.Core
109
136
 
110
137
  private sealed class AzurePipelineResponseHeaders : PipelineResponseHeaders
111
138
  {
112
- private readonly ResponseHeaders _headers;
139
+ private readonly Dictionary<string, string> _headerValues;
140
+ private readonly Dictionary<string, IEnumerable<string>> _headerValueCollections;
141
+ private readonly List<KeyValuePair<string, string>> _headerList;
113
142
 
114
143
  internal AzurePipelineResponseHeaders(ResponseHeaders headers)
115
144
  {
116
- _headers = headers;
145
+ _headerValues = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
146
+ _headerValueCollections = new Dictionary<string, IEnumerable<string>>(StringComparer.OrdinalIgnoreCase);
147
+ _headerList = new List<KeyValuePair<string, string>>();
148
+ foreach (HttpHeader header in headers)
149
+ {
150
+ if (!_headerValues.ContainsKey(header.Name))
151
+ {
152
+ _headerValues.Add(header.Name, header.Value);
153
+ }
154
+ if (!_headerValueCollections.ContainsKey(header.Name)
155
+ && headers.TryGetValues(header.Name, out IEnumerable<string>? values))
156
+ {
157
+ _headerValueCollections.Add(header.Name, new List<string>(values));
158
+ }
159
+ _headerList.Add(new KeyValuePair<string, string>(header.Name, header.Value));
160
+ }
117
161
  }
118
162
 
119
163
  public override bool TryGetValue(string name, out string? value)
120
- => _headers.TryGetValue(name, out value);
164
+ => _headerValues.TryGetValue(name, out value);
121
165
 
122
166
  public override bool TryGetValues(string name, out IEnumerable<string>? values)
123
- => _headers.TryGetValues(name, out values);
167
+ => _headerValueCollections.TryGetValue(name, out values);
124
168
 
125
169
  public override IEnumerator<KeyValuePair<string, string>> GetEnumerator()
126
170
  {
127
- foreach (HttpHeader header in _headers)
171
+ foreach (KeyValuePair<string, string> header in _headerList)
128
172
  {
129
- yield return new KeyValuePair<string, string>(header.Name, header.Value);
173
+ yield return header;
130
174
  }
131
175
  }
132
176
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-typespec/http-client-csharp",
3
- "version": "1.0.0-alpha.20260821.3",
3
+ "version": "1.0.0-alpha.20260824.2",
4
4
  "author": "Microsoft Corporation",
5
5
  "description": "TypeSpec library for emitting Azure libraries for C#.",
6
6
  "readme": "https://github.com/Azure/azure-sdk-for-net/blob/main/eng/packages/http-client-csharp/README.md",
@@ -39,7 +39,7 @@
39
39
  "dist/generator/**"
40
40
  ],
41
41
  "dependencies": {
42
- "@typespec/http-client-csharp": "1.0.0-alpha.20260821.2"
42
+ "@typespec/http-client-csharp": "1.0.0-alpha.20260824.4"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@azure-tools/azure-http-specs": "0.1.0-alpha.44",