-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ConfigureHttpJsonOptions for M.A.Htt.Json.JsonOptions
- Loading branch information
1 parent
07d728b
commit 83d405d
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.AspNetCore.Http.Json; | ||
using Microsoft.Extensions.DependencyInjection; | ||
|
||
namespace Microsoft.AspNetCore.Http; | ||
|
||
/// <summary> | ||
/// Extension methods to configure JSON serialization behavior. | ||
/// </summary> | ||
public static class HttpJsonServiceExtensions | ||
{ | ||
/// <summary> | ||
/// Configures options used for reading and writing JSON by route handlers. | ||
/// </summary> | ||
/// <remarks> | ||
/// The options configured here will only affect JSON returned and processed | ||
/// from route handlers, not controllers. | ||
/// </remarks> | ||
/// <param name="services">The <see cref="IServiceCollection" /> to configure options on.</param> | ||
/// <param name="configureOptions">The <see cref="Action{JsonOptions}"/> to configure the | ||
/// <see cref="JsonOptions"/>.</param> | ||
/// <returns>The modified <see cref="IServiceCollection"/>.</returns> | ||
public static IServiceCollection ConfigureHttpJsonOptions(this IServiceCollection services, Action<JsonOptions> configureOptions) | ||
{ | ||
services.Configure<JsonOptions>(configureOptions); | ||
return services; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
#nullable enable | ||
Microsoft.AspNetCore.Http.HttpJsonServiceExtensions | ||
static Microsoft.AspNetCore.Http.HttpJsonServiceExtensions.ConfigureHttpJsonOptions(this Microsoft.Extensions.DependencyInjection.IServiceCollection! services, System.Action<Microsoft.AspNetCore.Http.Json.JsonOptions!>! configureOptions) -> Microsoft.Extensions.DependencyInjection.IServiceCollection! |