This repository was archived by the owner on Dec 14, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Adding JsonInputFormatter for reading json encoded data from the request body #87
Closed
Changes from all commits
Commits
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
39 changes: 0 additions & 39 deletions
39
src/Microsoft.AspNet.Mvc.Core/Internal/ActionBindingContextExtensions.cs
This file was deleted.
Oops, something went wrong.
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
29 changes: 0 additions & 29 deletions
29
src/Microsoft.AspNet.Mvc.ModelBinding/Formatters/CompositeInputFormatter.cs
This file was deleted.
Oops, something went wrong.
20 changes: 18 additions & 2 deletions
20
src/Microsoft.AspNet.Mvc.ModelBinding/Formatters/IInputFormatter.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 |
---|---|---|
@@ -1,9 +1,25 @@ | ||
using System.Threading.Tasks; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.AspNet.Mvc.ModelBinding | ||
{ | ||
public interface IInputFormatter | ||
{ | ||
Task<bool> ReadAsync(InputFormatterContext context); | ||
/// <summary> | ||
/// Gets the mutable collection of media types supported by this <see cref="JsonInputFormatter"/> instance. | ||
/// </summary> | ||
IList<string> SupportedMediaTypes { get; } | ||
|
||
/// <summary> | ||
/// Gets the mutable collection of character encodings supported by this <see cref="JsonInputFormatter"/> | ||
/// instance. | ||
/// </summary> | ||
IList<Encoding> SupportedEncodings { get; } | ||
|
||
/// <summary> | ||
/// Called during deserialization to read an object from the request. | ||
/// </summary> | ||
Task ReadAsync(InputFormatterContext context); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/Microsoft.AspNet.Mvc.ModelBinding/Formatters/IInputFormatterProvider.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,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Microsoft.AspNet.Mvc.ModelBinding | ||
{ | ||
public interface IInputFormatterProvider | ||
{ | ||
IInputFormatter GetInputFormatter(InputFormatterProviderContext context); | ||
} | ||
} |
11 changes: 10 additions & 1 deletion
11
src/Microsoft.AspNet.Mvc.ModelBinding/Formatters/InputFormatterContext.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
22 changes: 22 additions & 0 deletions
22
src/Microsoft.AspNet.Mvc.ModelBinding/Formatters/InputFormatterProviderContext.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,22 @@ | ||
using Microsoft.AspNet.Abstractions; | ||
|
||
namespace Microsoft.AspNet.Mvc.ModelBinding | ||
{ | ||
public class InputFormatterProviderContext | ||
{ | ||
public InputFormatterProviderContext([NotNull] HttpContext httpContext, | ||
[NotNull] ModelMetadata metadata, | ||
[NotNull] ModelStateDictionary modelState) | ||
{ | ||
HttpContext = httpContext; | ||
Metadata = metadata; | ||
ModelState = modelState; | ||
} | ||
|
||
public HttpContext HttpContext { get; private set; } | ||
|
||
public ModelMetadata Metadata { get; private set; } | ||
|
||
public ModelStateDictionary ModelState { get; private set; } | ||
} | ||
} |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is this change related to the PR's title?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had a comment in the earlier iteration to remove the static helper that this was sitting in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍