@azure-typespec/http-client-csharp 1.0.0-alpha.20260807.3 → 1.0.0-alpha.20260807.4

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,9 +6,9 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.3": {
9
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.4": {
10
10
  "dependencies": {
11
- "Azure.Generator": "1.0.0-alpha.20260807.3",
11
+ "Azure.Generator": "1.0.0-alpha.20260807.4",
12
12
  "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260807.5",
13
13
  "System.ClientModel": "1.15.0"
14
14
  },
@@ -711,7 +711,7 @@
711
711
  }
712
712
  }
713
713
  },
714
- "Azure.Generator/1.0.0-alpha.20260807.3": {
714
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
715
715
  "dependencies": {
716
716
  "Azure.Core": "1.61.0",
717
717
  "Azure.Core.Expressions.DataFactory": "1.0.0",
@@ -721,14 +721,14 @@
721
721
  "runtime": {
722
722
  "Azure.Generator.dll": {
723
723
  "assemblyVersion": "1.0.0.0",
724
- "fileVersion": "1.0.26.40703"
724
+ "fileVersion": "1.0.26.40704"
725
725
  }
726
726
  }
727
727
  }
728
728
  }
729
729
  },
730
730
  "libraries": {
731
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.3": {
731
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.4": {
732
732
  "type": "project",
733
733
  "serviceable": false,
734
734
  "sha512": ""
@@ -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.20260807.3": {
1072
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
1073
1073
  "type": "project",
1074
1074
  "serviceable": false,
1075
1075
  "sha512": ""
@@ -6,7 +6,7 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator/1.0.0-alpha.20260807.3": {
9
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
10
10
  "dependencies": {
11
11
  "Azure.Core": "1.61.0",
12
12
  "Azure.Core.Expressions.DataFactory": "1.0.0",
@@ -715,7 +715,7 @@
715
715
  }
716
716
  },
717
717
  "libraries": {
718
- "Azure.Generator/1.0.0-alpha.20260807.3": {
718
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
719
719
  "type": "project",
720
720
  "serviceable": false,
721
721
  "sha512": ""
Binary file
Binary file
@@ -0,0 +1,132 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ using System;
5
+ using System.ClientModel.Primitives;
6
+ using System.Collections.Generic;
7
+ using System.IO;
8
+ using System.Threading;
9
+ using System.Threading.Tasks;
10
+
11
+ namespace Azure.Core
12
+ {
13
+ internal sealed class AzurePipelineResponse : PipelineResponse
14
+ {
15
+ private readonly Response _response;
16
+ private readonly PipelineResponseHeaders _headers;
17
+
18
+ internal AzurePipelineResponse(Response response)
19
+ {
20
+ _response = response;
21
+ _headers = new AzurePipelineResponseHeaders(response.Headers);
22
+ }
23
+
24
+ public override int Status => _response.Status;
25
+
26
+ public override string ReasonPhrase => _response.ReasonPhrase;
27
+
28
+ protected override PipelineResponseHeaders HeadersCore => _headers;
29
+
30
+ public override Stream? ContentStream
31
+ {
32
+ get => _response.ContentStream;
33
+ set => _response.ContentStream = value;
34
+ }
35
+
36
+ public override BinaryData Content => _response.Content;
37
+
38
+ public override BinaryData BufferContent(CancellationToken cancellationToken = default)
39
+ {
40
+ Stream? responseContentStream = _response.ContentStream;
41
+ if (responseContentStream is not MemoryStream)
42
+ {
43
+ var content = new MemoryStream();
44
+ try
45
+ {
46
+ if (responseContentStream is not null)
47
+ {
48
+ CopyTo(responseContentStream, content, cancellationToken);
49
+ }
50
+ content.Position = 0;
51
+ responseContentStream?.Dispose();
52
+ _response.ContentStream = content;
53
+ }
54
+ catch
55
+ {
56
+ content.Dispose();
57
+ throw;
58
+ }
59
+ }
60
+
61
+ return _response.Content;
62
+ }
63
+
64
+ public override async ValueTask<BinaryData> BufferContentAsync(CancellationToken cancellationToken = default)
65
+ {
66
+ Stream? responseContentStream = _response.ContentStream;
67
+ if (responseContentStream is not MemoryStream)
68
+ {
69
+ var content = new MemoryStream();
70
+ try
71
+ {
72
+ if (responseContentStream is not null)
73
+ {
74
+ await responseContentStream.CopyToAsync(content, 81920, cancellationToken).ConfigureAwait(false);
75
+ }
76
+ content.Position = 0;
77
+ responseContentStream?.Dispose();
78
+ _response.ContentStream = content;
79
+ }
80
+ catch
81
+ {
82
+ content.Dispose();
83
+ throw;
84
+ }
85
+ }
86
+
87
+ return _response.Content;
88
+ }
89
+
90
+ public override void Dispose() => _response.Dispose();
91
+
92
+ private static void CopyTo(Stream source, Stream destination, CancellationToken cancellationToken)
93
+ {
94
+ byte[] buffer = new byte[81920];
95
+ while (true)
96
+ {
97
+ cancellationToken.ThrowIfCancellationRequested();
98
+ int bytesRead = source.Read(buffer, 0, buffer.Length);
99
+ if (bytesRead == 0)
100
+ {
101
+ return;
102
+ }
103
+
104
+ destination.Write(buffer, 0, bytesRead);
105
+ }
106
+ }
107
+
108
+ private sealed class AzurePipelineResponseHeaders : PipelineResponseHeaders
109
+ {
110
+ private readonly ResponseHeaders _headers;
111
+
112
+ internal AzurePipelineResponseHeaders(ResponseHeaders headers)
113
+ {
114
+ _headers = headers;
115
+ }
116
+
117
+ public override bool TryGetValue(string name, out string? value)
118
+ => _headers.TryGetValue(name, out value);
119
+
120
+ public override bool TryGetValues(string name, out IEnumerable<string>? values)
121
+ => _headers.TryGetValues(name, out values);
122
+
123
+ public override IEnumerator<KeyValuePair<string, string>> GetEnumerator()
124
+ {
125
+ foreach (HttpHeader header in _headers)
126
+ {
127
+ yield return new KeyValuePair<string, string>(header.Name, header.Value);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
@@ -6,9 +6,9 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.3": {
9
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.4": {
10
10
  "dependencies": {
11
- "Azure.Generator": "1.0.0-alpha.20260807.3",
11
+ "Azure.Generator": "1.0.0-alpha.20260807.4",
12
12
  "Microsoft.TypeSpec.Generator.ClientModel": "1.0.0-alpha.20260807.5",
13
13
  "System.ClientModel": "1.15.0"
14
14
  },
@@ -711,7 +711,7 @@
711
711
  }
712
712
  }
713
713
  },
714
- "Azure.Generator/1.0.0-alpha.20260807.3": {
714
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
715
715
  "dependencies": {
716
716
  "Azure.Core": "1.61.0",
717
717
  "Azure.Core.Expressions.DataFactory": "1.0.0",
@@ -721,14 +721,14 @@
721
721
  "runtime": {
722
722
  "Azure.Generator.dll": {
723
723
  "assemblyVersion": "1.0.0.0",
724
- "fileVersion": "1.0.26.40703"
724
+ "fileVersion": "1.0.26.40704"
725
725
  }
726
726
  }
727
727
  }
728
728
  }
729
729
  },
730
730
  "libraries": {
731
- "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.3": {
731
+ "Azure.Generator.StubLibrary/1.0.0-alpha.20260807.4": {
732
732
  "type": "project",
733
733
  "serviceable": false,
734
734
  "sha512": ""
@@ -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.20260807.3": {
1072
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
1073
1073
  "type": "project",
1074
1074
  "serviceable": false,
1075
1075
  "sha512": ""
@@ -6,7 +6,7 @@
6
6
  "compilationOptions": {},
7
7
  "targets": {
8
8
  ".NETCoreApp,Version=v10.0": {
9
- "Azure.Generator/1.0.0-alpha.20260807.3": {
9
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
10
10
  "dependencies": {
11
11
  "Azure.Core": "1.61.0",
12
12
  "Azure.Core.Expressions.DataFactory": "1.0.0",
@@ -715,7 +715,7 @@
715
715
  }
716
716
  },
717
717
  "libraries": {
718
- "Azure.Generator/1.0.0-alpha.20260807.3": {
718
+ "Azure.Generator/1.0.0-alpha.20260807.4": {
719
719
  "type": "project",
720
720
  "serviceable": false,
721
721
  "sha512": ""
@@ -0,0 +1,132 @@
1
+ // Copyright (c) Microsoft Corporation. All rights reserved.
2
+ // Licensed under the MIT License.
3
+
4
+ using System;
5
+ using System.ClientModel.Primitives;
6
+ using System.Collections.Generic;
7
+ using System.IO;
8
+ using System.Threading;
9
+ using System.Threading.Tasks;
10
+
11
+ namespace Azure.Core
12
+ {
13
+ internal sealed class AzurePipelineResponse : PipelineResponse
14
+ {
15
+ private readonly Response _response;
16
+ private readonly PipelineResponseHeaders _headers;
17
+
18
+ internal AzurePipelineResponse(Response response)
19
+ {
20
+ _response = response;
21
+ _headers = new AzurePipelineResponseHeaders(response.Headers);
22
+ }
23
+
24
+ public override int Status => _response.Status;
25
+
26
+ public override string ReasonPhrase => _response.ReasonPhrase;
27
+
28
+ protected override PipelineResponseHeaders HeadersCore => _headers;
29
+
30
+ public override Stream? ContentStream
31
+ {
32
+ get => _response.ContentStream;
33
+ set => _response.ContentStream = value;
34
+ }
35
+
36
+ public override BinaryData Content => _response.Content;
37
+
38
+ public override BinaryData BufferContent(CancellationToken cancellationToken = default)
39
+ {
40
+ Stream? responseContentStream = _response.ContentStream;
41
+ if (responseContentStream is not MemoryStream)
42
+ {
43
+ var content = new MemoryStream();
44
+ try
45
+ {
46
+ if (responseContentStream is not null)
47
+ {
48
+ CopyTo(responseContentStream, content, cancellationToken);
49
+ }
50
+ content.Position = 0;
51
+ responseContentStream?.Dispose();
52
+ _response.ContentStream = content;
53
+ }
54
+ catch
55
+ {
56
+ content.Dispose();
57
+ throw;
58
+ }
59
+ }
60
+
61
+ return _response.Content;
62
+ }
63
+
64
+ public override async ValueTask<BinaryData> BufferContentAsync(CancellationToken cancellationToken = default)
65
+ {
66
+ Stream? responseContentStream = _response.ContentStream;
67
+ if (responseContentStream is not MemoryStream)
68
+ {
69
+ var content = new MemoryStream();
70
+ try
71
+ {
72
+ if (responseContentStream is not null)
73
+ {
74
+ await responseContentStream.CopyToAsync(content, 81920, cancellationToken).ConfigureAwait(false);
75
+ }
76
+ content.Position = 0;
77
+ responseContentStream?.Dispose();
78
+ _response.ContentStream = content;
79
+ }
80
+ catch
81
+ {
82
+ content.Dispose();
83
+ throw;
84
+ }
85
+ }
86
+
87
+ return _response.Content;
88
+ }
89
+
90
+ public override void Dispose() => _response.Dispose();
91
+
92
+ private static void CopyTo(Stream source, Stream destination, CancellationToken cancellationToken)
93
+ {
94
+ byte[] buffer = new byte[81920];
95
+ while (true)
96
+ {
97
+ cancellationToken.ThrowIfCancellationRequested();
98
+ int bytesRead = source.Read(buffer, 0, buffer.Length);
99
+ if (bytesRead == 0)
100
+ {
101
+ return;
102
+ }
103
+
104
+ destination.Write(buffer, 0, bytesRead);
105
+ }
106
+ }
107
+
108
+ private sealed class AzurePipelineResponseHeaders : PipelineResponseHeaders
109
+ {
110
+ private readonly ResponseHeaders _headers;
111
+
112
+ internal AzurePipelineResponseHeaders(ResponseHeaders headers)
113
+ {
114
+ _headers = headers;
115
+ }
116
+
117
+ public override bool TryGetValue(string name, out string? value)
118
+ => _headers.TryGetValue(name, out value);
119
+
120
+ public override bool TryGetValues(string name, out IEnumerable<string>? values)
121
+ => _headers.TryGetValues(name, out values);
122
+
123
+ public override IEnumerator<KeyValuePair<string, string>> GetEnumerator()
124
+ {
125
+ foreach (HttpHeader header in _headers)
126
+ {
127
+ yield return new KeyValuePair<string, string>(header.Name, header.Value);
128
+ }
129
+ }
130
+ }
131
+ }
132
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure-typespec/http-client-csharp",
3
- "version": "1.0.0-alpha.20260807.3",
3
+ "version": "1.0.0-alpha.20260807.4",
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",