-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Improve Minimal APIs support for request media types #35082 #35230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
f855193
add support for request media types
rafikiassumani-msft 8133bff
change namespace for acceptsmatcher policy
rafikiassumani-msft 17853dd
additional changes
rafikiassumani-msft a24a181
enable 415 when unsupported content type is provide
rafikiassumani-msft 2116e6d
add accepts extension method on minimalActions endpoint
rafikiassumani-msft 6700e93
add IAcceptsMetadata to API description
rafikiassumani-msft 094ed22
add empty content type test
rafikiassumani-msft ab29717
feat: add types for iacceptmetadata
rafikiassumani-msft 94fa1a7
change requestdelegate factory to return metatdata
rafikiassumani-msft 8096fd3
clean RequestDelegateFactoryOptions.cs
rafikiassumani-msft ce440cb
change request delegate to return requestdelegateresult type
rafikiassumani-msft 74b234b
make apis property init only
rafikiassumani-msft 990be74
adding constructor to requestdelegatefactoryResult
rafikiassumani-msft 0097323
Fixups
pranavkm 6b108eb
resolve conflicts
rafikiassumani-msft d4e85d5
fix merge errors
rafikiassumani-msft 3de78c6
address pr comment
rafikiassumani-msft c3d2cd3
fix test error
rafikiassumani-msft 9ec2bcd
remove options from params
rafikiassumani-msft 9d440ab
implements iacceptsMetadata
rafikiassumani-msft 78667ac
merge conflicts
rafikiassumani-msft be64e8e
fix test failures
rafikiassumani-msft 85b38ca
fix test failures
rafikiassumani-msft f6762c9
move iacceptmetadata to shared source
rafikiassumani-msft d4daaa7
add acceptsmetadata shared code to mvc
rafikiassumani-msft ad8ed0c
resolve conflicts
rafikiassumani-msft f43d3c0
fix tests
rafikiassumani-msft 7b664f8
fix merge conflicts
rafikiassumani-msft 2b638db
address pr comments
rafikiassumani-msft 14a7ff9
address another comment
rafikiassumani-msft 38790ae
nit
rafikiassumani-msft 8a8348e
fix duplicate media types
rafikiassumani-msft 88f6c6c
resolve merge conflicts
rafikiassumani-msft b29ea2a
fix test failures
rafikiassumani-msft File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
src/Http/Http.Abstractions/src/Metadata/IAcceptsMetadata.cs
This file contains hidden or 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,25 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
|
||
using System.Collections.Generic; | ||
|
||
namespace Microsoft.AspNetCore.Http.Metadata | ||
{ | ||
/// <summary> | ||
/// Interface for accepting request media types. | ||
/// </summary> | ||
public interface IAcceptsMetadata | ||
{ | ||
/// <summary> | ||
/// Gets a list of the allowed request content types. | ||
/// If the incoming request does not have a <c>Content-Type</c> with one of these values, the request will be rejected with a 415 response. | ||
/// </summary> | ||
IReadOnlyList<string> ContentTypes { get; } | ||
rafikiassumani-msft marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
/// <summary> | ||
/// Gets the type being read from the request. | ||
/// </summary> | ||
Type? RequestType { get; } | ||
} | ||
} |
This file contains hidden or 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
This file contains hidden or 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,33 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.AspNetCore.Http | ||
{ | ||
/// <summary> | ||
/// The result of creating a <see cref="RequestDelegate" /> from a <see cref="Delegate" /> | ||
/// </summary> | ||
public sealed class RequestDelegateResult | ||
{ | ||
/// <summary> | ||
/// Creates a new instance of <see cref="RequestDelegateResult"/>. | ||
/// </summary> | ||
public RequestDelegateResult(RequestDelegate requestDelegate, IReadOnlyList<object> metadata) | ||
{ | ||
RequestDelegate = requestDelegate; | ||
EndpointMetadata = metadata; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the <see cref="RequestDelegate" /> | ||
/// </summary> | ||
public RequestDelegate RequestDelegate { get;} | ||
|
||
/// <summary> | ||
/// Gets endpoint metadata inferred from creating the <see cref="RequestDelegate" /> | ||
/// </summary> | ||
public IReadOnlyList<object> EndpointMetadata { get;} | ||
} | ||
|
||
} |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.