199 instantiations of StringContent
aspire (1)
Utils\EnvironmentChecker\DcpConnectionChecker.cs (1)
336
Content = new
StringContent
("""{"status":"Stopping","shutdownResourceCleanup":"None"}""", Encoding.UTF8, "application/merge-patch+json")
Aspire.Cli.Tests (96)
Agents\AspireSkillsInstallerTests.cs (1)
2180
Content = new
StringContent
(json)
Agents\SigstoreNpmProvenanceCheckerTests.cs (1)
1192
Content = new
StringContent
(attestationJson, Encoding.UTF8, "application/json")
Commands\AgentMcpCommandTests.cs (2)
53
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
60
Content = new
StringContent
("{\"data\":{},\"totalCount\":0,\"returnedCount\":0}", System.Text.Encoding.UTF8, "application/json")
Commands\ExportCommandTests.cs (5)
247
Content = new
StringContent
(resourcesJson, System.Text.Encoding.UTF8, "application/json")
254
Content = new
StringContent
(BuildLogsJson(), System.Text.Encoding.UTF8, "application/json")
261
Content = new
StringContent
(BuildTracesJson(), System.Text.Encoding.UTF8, "application/json")
904
Content = new
StringContent
(resourcesJson, System.Text.Encoding.UTF8, "application/json")
914
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
Commands\TelemetryCommandTests.cs (6)
332
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
349
Content = new
StringContent
(body!, System.Text.Encoding.UTF8, contentType!)
389
Content = new
StringContent
("""{"apiKey":"test-api-key-123"}""", System.Text.Encoding.UTF8, "application/json")
406
Content = new
StringContent
("""{"apiKey":null}""", System.Text.Encoding.UTF8, "application/json")
482
Content = new
StringContent
("""{"apiKey":"key"}""", System.Text.Encoding.UTF8, "application/json")
499
Content = new
StringContent
("""{"apiKey":"key"}""", System.Text.Encoding.UTF8, "application/json")
Commands\TelemetryLogsCommandTests.cs (15)
195
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
203
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
247
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
255
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
339
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
377
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
420
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
493
Content = new
StringContent
("<html></html>", System.Text.Encoding.UTF8, "text/html")
530
Content = new
StringContent
("""{"apiKey":"test-key"}""", System.Text.Encoding.UTF8, "application/json")
537
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
545
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
621
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
628
Content = new
StringContent
(responseJson, System.Text.Encoding.UTF8, "application/json")
685
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
694
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
Commands\TelemetrySpansCommandTests.cs (10)
168
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
176
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
239
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
281
Content = new
StringContent
("<html></html>", System.Text.Encoding.UTF8, "text/html")
355
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
362
Content = new
StringContent
(responseJson, System.Text.Encoding.UTF8, "application/json")
424
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
433
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
471
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
480
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
Commands\TelemetryTestHelper.cs (2)
98
Content = new
StringContent
(resourcesJson, System.Text.Encoding.UTF8, "application/json")
108
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
Commands\TelemetryTracesCommandTests.cs (15)
108
Content = new
StringContent
(resourcesJson, System.Text.Encoding.UTF8, "application/json")
112
Content = new
StringContent
(tracesJson, System.Text.Encoding.UTF8, "application/json")
195
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
199
Content = new
StringContent
(tracesJson, System.Text.Encoding.UTF8, "application/json")
413
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
421
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
484
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
559
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
566
Content = new
StringContent
(responseJson, System.Text.Encoding.UTF8, "application/json")
643
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
650
Content = new
StringContent
(responseJson, System.Text.Encoding.UTF8, "application/json")
690
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
699
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
737
Content = new
StringContent
("[]", System.Text.Encoding.UTF8, "application/json")
746
Content = new
StringContent
(json, System.Text.Encoding.UTF8, "application/json")
Mcp\ApiDocs\ApiDocsCacheTests.cs (2)
29
Content = new
StringContent
("<urlset></urlset>")
55
Content = new
StringContent
("# Methods")
Mcp\ApiDocs\ApiDocsFetcherTests.cs (3)
30
Content = new
StringContent
(expectedContent)
56
Content = new
StringContent
(expectedContent)
83
Content = new
StringContent
(expectedContent)
Mcp\Docs\DocsCacheTests.cs (1)
28
Content = new
StringContent
("# Content")
Mcp\Docs\DocsFetcherTests.cs (9)
36
Content = new
StringContent
(expectedContent)
55
Content = new
StringContent
("# Content")
77
Content = new
StringContent
(content)
159
Content = new
StringContent
(freshContent)
226
Content = new
StringContent
("")
246
Content = new
StringContent
(whitespace)
329
Content = new
StringContent
(serverContent)
362
Content = new
StringContent
(serverContent)
405
Content = new
StringContent
("# Content")
Mcp\ExcludeFromMcpTests.cs (2)
564
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
570
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
Mcp\ListStructuredLogsToolTests.cs (8)
160
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
167
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
254
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
261
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
309
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
316
Content = new
StringContent
(emptyLogsJson, System.Text.Encoding.UTF8, "application/json")
448
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
455
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
Mcp\ListTracesToolTests.cs (10)
132
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
139
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
239
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
246
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
294
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
301
Content = new
StringContent
(emptyTracesJson, System.Text.Encoding.UTF8, "application/json")
398
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
404
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
490
Content = new
StringContent
(resourcesResponse, System.Text.Encoding.UTF8, "application/json")
497
Content = new
StringContent
(apiResponse, System.Text.Encoding.UTF8, "application/json")
ProfileCaptureServiceTests.cs (3)
419
Content = new
StringContent
("<html></html>", Encoding.UTF8, "text/html")
435
Content = new
StringContent
("{", Encoding.UTF8, "application/json")
605
Content = new
StringContent
(
Telemetry\InternalMicrosoftDetectorTests.cs (1)
592
Content = new
StringContent
(json, Encoding.UTF8, "application/json")
Aspire.Dashboard.Tests (13)
Integration\OtlpHttpJsonTests.cs (9)
507
var content = new
StringContent
(ExampleTraceJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
567
var content = new
StringContent
(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
644
var content = new
StringContent
(ExampleEventsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
694
var content = new
StringContent
(ExampleMetricsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
746
var content = new
StringContent
(MetricsJsonWithNumericBucketCounts, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
836
var content = new
StringContent
(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
864
var content = new
StringContent
(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
882
var content = new
StringContent
("{ invalid json }", Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
900
var content = new
StringContent
("{}", Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
Telemetry\DashboardTelemetrySenderTests.cs (1)
87
return Task.FromResult(new HttpResponseMessage(telemetryEnabledResponseStatusCode.Value) { Content = new
StringContent
(telemetryEnabledResponseBody ?? string.Empty) });
Telemetry\DashboardTelemetryServiceTests.cs (3)
110
Content = new
StringContent
(JsonSerializer.Serialize(new TelemetryEnabledResponse(IsEnabled: true)) ?? string.Empty)
125
Content = new
StringContent
(JsonSerializer.Serialize(new TelemetryEventCorrelation { Id = userTaskCorrelationId }))
135
Content = new
StringContent
(JsonSerializer.Serialize(new TelemetryEventCorrelation { Id = Guid.NewGuid() }))
Aspire.Hosting (3)
Dcp\DcpKubernetesClient.cs (1)
130
httpRequest.Content = new
StringContent
(content, System.Text.Encoding.UTF8);
ResourceBuilderExtensions.cs (2)
3849
? new
StringContent
(requestData.Content, Encoding.UTF8, requestData.ContentType)
3850
: new
StringContent
(requestData.Content, Encoding.UTF8);
Aspire.Hosting.Azure.Tests (4)
AcrLoginServiceTests.cs (4)
27
Content = new
StringContent
("""{"refresh_token":"refresh-token"}""")
53
Content = new
StringContent
("bad request")
75
Content = new
StringContent
("registry not ready")
97
Content = new
StringContent
("registry not ready")
Aspire.Hosting.Foundry.Tests (1)
HostedAgentExtensionTests.cs (1)
819
Content = new
StringContent
(responseBody, Encoding.UTF8, mediaType)
Aspire.Hosting.GitHub.Models (1)
GitHubModelsHealthCheck.cs (1)
53
request.Content = new
StringContent
(jsonPayload, System.Text.Encoding.UTF8, "application/json");
Aspire.Hosting.PostgreSQL.Tests (1)
PostgresFunctionalTests.cs (1)
173
{ new
StringContent
(dbName), "bookmark_id" }
Aspire.Hosting.Seq.Tests (1)
SeqFunctionalTests.cs (1)
55
var content = new
StringContent
(payload, Encoding.UTF8, "application/json");
Aspire.Hosting.Tests (6)
WithHttpCommandTests.cs (6)
52
Content = new
StringContent
("""{"token":"abc123"}""", Encoding.UTF8, "application/json")
67
Content = new
StringContent
("""{"token":"abc123"}""", Encoding.UTF8, "application/json")
86
Content = new
StringContent
("invalid request", Encoding.UTF8, "text/plain")
580
? new
StringContent
(responseBody, Encoding.UTF8, mediaType)
581
: new
StringContent
(responseBody);
763
requestContext.Request.Content = new
StringContent
(message, Encoding.UTF8, "text/plain");
Binding.Http.IntegrationTests (1)
BasicHttpBindingTests.4.0.0.cs (1)
165
message.Content = new
StringContent
(requestMessageBody);
Microsoft.Arcade.Common (1)
ArcadeHttpMessageHandler.cs (1)
34
Content = new
StringContent
($"No response specified in RequestResponses for '({request.Method}) {request.RequestUri}")
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (7)
Logging\AcceptanceTests.cs (7)
216
using var content = new
StringContent
(Content);
276
using var content = new
StringContent
(Content, null, requestContentType);
329
using var content = new
StringContent
(Content, null, MediaTypeNames.Text.Html);
380
Content = new
StringContent
(Content)
692
using var content = new
StringContent
(Content);
726
using var content = new
StringContent
(Content);
755
using var content = new
StringContent
("Client: hello!");
Microsoft.Extensions.AI.Evaluation.Safety (1)
ContentSafetyService.cs (1)
416
request.Content = new
StringContent
(payload ?? string.Empty);
Microsoft.Extensions.AI.Integration.Tests (2)
VerbatimHttpHandler.cs (1)
86
return new() { Content = new
StringContent
(_expectedOutput) };
VerbatimMultiPartHttpHandler.cs (1)
153
return new() { Content = new
StringContent
(sentJsonOutput, Encoding.UTF8, "application/json") };
Microsoft.Extensions.AI.OpenAI.Tests (12)
OpenAIHostedFileClientTests.cs (11)
576
Content = new
StringContent
("""
610
Content = new
StringContent
("""
650
Content = new
StringContent
("""
675
Content = new
StringContent
("""
705
Content = new
StringContent
("""
732
Content = new
StringContent
("""
769
Content = new
StringContent
("""
804
Content = new
StringContent
("{}", Encoding.UTF8, "application/json")
834
Content = new
StringContent
("""
859
Content = new
StringContent
("""
903
Task.FromResult(new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new
StringContent
("{}") });
OpenAIResponseClientTests.cs (1)
6884
return new HttpResponseMessage { Content = new
StringContent
(body) };
Microsoft.Extensions.Http.Diagnostics.Tests (46)
Logging\HttpClientLoggerTest.cs (17)
87
Content = new
StringContent
(input, Encoding.UTF8, TextPlain)
125
Content = new
StringContent
(input, Encoding.UTF8, TextPlain)
187
Content = new
StringContent
(requestContent, Encoding.UTF8, TextPlain)
196
Content = new
StringContent
(responseContent, Encoding.UTF8, TextPlain),
284
Content = new
StringContent
(requestContent, Encoding.UTF8, TextPlain)
291
Content = new
StringContent
(responseContent, Encoding.UTF8, TextPlain),
391
Content = new
StringContent
(requestContent, Encoding.UTF8, TextPlain)
399
Content = new
StringContent
(responseContent, Encoding.UTF8, TextPlain),
488
Content = new
StringContent
(requestContent, Encoding.UTF8, TextPlain)
496
Content = new
StringContent
(responseContent, Encoding.UTF8, TextPlain),
604
Content = new
StringContent
(requestContent, Encoding.UTF8, TextPlain)
611
Content = new
StringContent
(responseContent, Encoding.UTF8, TextPlain),
697
Content = new
StringContent
(_fixture.Create<string>(), Encoding.UTF8, TextPlain)
740
Content = new
StringContent
(_fixture.Create<string>(), Encoding.UTF8, TextPlain)
778
Content = new
StringContent
(_fixture.Create<string>(), Encoding.UTF8, TextPlain)
822
Content = new
StringContent
(_fixture.Create<string>(), Encoding.UTF8, TextPlain)
969
Content = new
StringContent
("request_content", Encoding.UTF8, TextPlain)
Logging\HttpHeadersReaderTest.cs (2)
131
using var requestContent = new
StringContent
(string.Empty);
140
using var responseContent = new
StringContent
(string.Empty);
Logging\HttpRequestBodyReaderTest.cs (6)
41
Content = new
StringContent
(input, Encoding.UTF8, "text/plain"),
85
Content = new
StringContent
(input, Encoding.UTF8, contentType),
106
Content = new
StringContent
(input, Encoding.UTF8, "text/plain"),
134
Content = new
StringContent
(input, Encoding.UTF8, "text/plain"),
158
Content = new
StringContent
(input, Encoding.UTF8, "text/plain"),
232
Content = new
StringContent
("content", Encoding.UTF8, "text/plain"),
Logging\HttpRequestReaderTest.cs (17)
87
Content = new
StringContent
(requestContent, Encoding.UTF8)
96
Content = new
StringContent
(responseContent, Encoding.UTF8)
152
Content = new
StringContent
(requestContent, Encoding.UTF8)
158
Content = new
StringContent
(responseContent, Encoding.UTF8)
217
Content = new
StringContent
(requestContent, Encoding.UTF8),
229
Content = new
StringContent
(responseContent, Encoding.UTF8)
293
Content = new
StringContent
(requestContent, Encoding.UTF8),
305
Content = new
StringContent
(responseContent, Encoding.UTF8)
366
Content = new
StringContent
(requestContent, Encoding.UTF8),
426
Content = new
StringContent
(requestContent, Encoding.UTF8),
438
Content = new
StringContent
(responseContent, Encoding.UTF8)
499
Content = new
StringContent
(requestContent, Encoding.UTF8),
507
Content = new
StringContent
(responseContent, Encoding.UTF8)
568
Content = new
StringContent
(requestContent, Encoding.UTF8),
577
Content = new
StringContent
(responseContent, Encoding.UTF8)
665
Content = new
StringContent
(requestContent, Encoding.UTF8, "text/plain")
900
httpRequestMessage.Content = new
StringContent
(requestContent, Encoding.UTF8, "text/plain");
Logging\HttpResponseBodyReaderTest.cs (4)
50
Content = new
StringContent
(expectedContentBody, Encoding.UTF8, TextPlain)
86
Content = new
StringContent
(string.Empty, Encoding.UTF8, TextPlain)
111
Content = new
StringContent
(expectedContentBody, Encoding.UTF8, contentType)
131
Content = new
StringContent
(input, Encoding.UTF8, TextPlain)
Microsoft.Extensions.Http.Resilience.Tests (1)
Resilience\RequestMessageSnapshotTests.cs (1)
60
Content = new
StringContent
("{\"name\":\"John Doe\",\"age\":33}", Encoding.UTF8, "application/json")
Microsoft.NET.Build.Containers (1)
Registry\DefaultManifestOperations.cs (1)
56
HttpContent manifestUploadContent = new
StringContent
(manifestJson);
34 references to StringContent
Aspire.Dashboard.Tests (9)
Integration\OtlpHttpJsonTests.cs (9)
507
var
content = new StringContent(ExampleTraceJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
567
var
content = new StringContent(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
644
var
content = new StringContent(ExampleEventsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
694
var
content = new StringContent(ExampleMetricsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
746
var
content = new StringContent(MetricsJsonWithNumericBucketCounts, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
836
var
content = new StringContent(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
864
var
content = new StringContent(ExampleLogsJson, Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
882
var
content = new StringContent("{ invalid json }", Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
900
var
content = new StringContent("{}", Encoding.UTF8, OtlpHttpEndpointsBuilder.JsonContentType);
Aspire.Hosting.Seq.Tests (1)
SeqFunctionalTests.cs (1)
55
var
content = new StringContent(payload, Encoding.UTF8, "application/json");
Microsoft.AspNetCore.Diagnostics.Middleware.Tests (6)
Logging\AcceptanceTests.cs (6)
216
using
var
content = new StringContent(Content);
276
using
var
content = new StringContent(Content, null, requestContentType);
329
using
var
content = new StringContent(Content, null, MediaTypeNames.Text.Html);
692
using
var
content = new StringContent(Content);
726
using
var
content = new StringContent(Content);
755
using
var
content = new StringContent("Client: hello!");
Microsoft.Extensions.Http.Diagnostics.Tests (2)
Logging\HttpHeadersReaderTest.cs (2)
131
using
var
requestContent = new StringContent(string.Empty);
140
using
var
responseContent = new StringContent(string.Empty);
netstandard (1)
netstandard.cs (1)
1138
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.Http.
StringContent
))]
System.Net.Http (15)
System\Net\Http\StringContent.cs (15)
19
/// <summary>Creates a new instance of the <see cref="
StringContent
"/> class.</summary>
20
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
21
/// <remarks>The media type for the <see cref="
StringContent
"/> created defaults to text/plain.</remarks>
27
/// <summary>Creates a new instance of the <see cref="
StringContent
"/> class.</summary>
28
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
35
/// <summary>Creates a new instance of the <see cref="
StringContent
"/> class.</summary>
36
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
38
/// <remarks>The media type for the <see cref="
StringContent
"/> created defaults to text/plain.</remarks>
44
/// <summary>Creates a new instance of the <see cref="
StringContent
"/> class.</summary>
45
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
76
/// <summary>Creates a new instance of the <see cref="
StringContent
"/> class.</summary>
77
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
87
/// <param name="content">The content used to initialize the <see cref="
StringContent
"/>.</param>
108
GetType() == typeof(
StringContent
) ? SerializeToStreamAsyncCore(stream, cancellationToken) :
112
GetType() == typeof(
StringContent
) ? CreateMemoryStreamForByteArray() : // type check ensures we use possible derived type's CreateContentReadStreamAsync override