Commit Graph

20 Commits

Author SHA1 Message Date
Kiran Challa 8ac6b6699f [Fixes #4945] Simple string returned by controller action is not a valid JSON! 2017-01-25 13:29:18 -08:00
Ryan Brandenburg 6396e14504 Add null-check back to MediaType 2017-01-18 16:56:08 -08:00
Ryan Brandenburg 93774a0234 Mitigate MediaType overflow 2017-01-13 12:51:19 -08:00
Doug Bunting f04286562e Treat `ContentType==null` and `MediaType.GetEncoding(ContentType)==null` differently
- now, if client sends e.g. `Content-type: text/json;charset=[invalid]`, service will respond with HTTP/415
 - if client sends `Content-type: text/json`, service will still try UTF-8 (or updated default encoding)
 - intentional (and slight) behaviour change from 1ac7315
- include and a few new tests and some cleanup from same commit
2016-11-03 10:51:39 -07:00
Doug Bunting 116c927e61 Revert "Do not call `Encoding.GetEncoding()` with a string from the request"
- #5351 should be Won't Fix

This reverts commit 1ac731519a.
2016-11-03 10:51:39 -07:00
Doug Bunting 1ac731519a Do not call `Encoding.GetEncoding()` with a string from the request
- #5351
- fix affects only `TextInputFormatter`
 - `TextOutputFormatter` already does the Right Thing™️ with `Accept-Charset` headers
 - `ResponseContentTypeHelper` uses `Encoding.GetEncoding()` but is not passed request data
2016-10-24 14:59:49 -07:00
Doug Bunting 3fdcaecaa8 Correctly handle quoted media type parameter values
- #5349
- fix or add comments about other parsing errors and inconsistencies
 - `MediaType` did not skip whitespace before the type

nits:
- use `+=`
- `<code>` -> `<c>` since the former is not for use within a paragraph
- split tests up to remove `bool expectedResult` parameters
2016-10-24 13:16:09 -07:00
Doug Bunting 4cca6b09f0 Reduce allocations during HTML generation
- #3918
- precompute size of `StringBuilder` in `ExpressionHelper`
- reduce `string` allocations in `ViewDataEvaluator`
 - also get rid of `Enumeration` state machines
- reduce the size of a few objects; use more expression-valued properties
 - e.g. don't store `_modelType` in `ModelExplorer`
- add `EmptyArray<TElement>`; make empty arrays consistently `static`
- avoid `string.Split()` in HTML and tag helpers

nits:
- make `ExpressionHelperTest` tests more stringent
- correct `Message` for an `ArgumentNullException`
- remove excess `using`s in classes I touched (but often ended up leaving otherwise unchanged)
- improve doc comments
- remove `ToString()` call on a `string`
- avoid encoding `string.Empty`
- fix test file name
- remove useless variables
- correct spelling
- improve whitespace
2016-10-03 12:17:47 -07:00
Kiran Challa 26b3b5ea7b [Fixes #4766] Remove disable buffering feature from our action result classes 2016-07-18 13:07:54 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -07:00
Derek Gray 5a3875ea72 Alter content negotiation algorithm so that it can be configured (via
MvcOptions) to always respect an explicit Accept header. Fixes #4612.
2016-06-07 16:12:36 -05:00
Kiran Challa 20a2e748ec Added ValueProviderFactories to ResourceFilterExecutingContext
This enables removing value provider factories from model binding(which is needed in some scenarios like large file uploads)
2016-05-20 04:15:07 -07:00
Doug Bunting d8d2e54506 Remove extra options to manipulate `JsonSerializerSettings`
- #4339: remove non-recommended JSON formatter constructors
 - affects `JsonInputFormatter`, `JsonOutputFormatter`, `JsonPatchInputFormatter`
 - `JsonOutputFormatter` cleanup also impacts `JsonHelper`
 - rename and make `SerializerSettingsProvider` class public; use it as appropriate
- #4409: make `SerializerSetings` properties get-only and `protected`
 - affects `JsonInputFormatter`, `JsonOutputFormatter`

Recommended patterns:
- change `JsonSerializerSettings` values in `MvcJsonOptions` for almost all customizations
- find `JsonOutputFormatter` in `MvcOptions.OutputFormatters` when limiting per-result formatters
- start with `JsonSerializerSettingsProvider.CreateSerializerSettings()` when customizing a per-result formatter
2016-04-27 14:48:16 -07:00
Doug Bunting 6bf25cecec React to HttpAbstractions namespace changes
- aspnet/HttpAbstractions#549 and aspnet/HttpAbstractions#592
- clean up `using`s
2016-03-30 16:19:42 -07:00
Kiran Challa fd3ee49987 [Fixes #4085] Controller helper inconsistency: HttpNotFound(), Ok() 2016-02-19 09:25:04 -08:00
jacalvar 910f0139f9 [Fixes #4050] Throw an exception on CanRead/Write and GetSupportedContentTypes when the list of media types is empty 2016-02-16 17:16:16 -08:00
jacalvar 65858b8d8b [Fixes #4051] Split OutputFormatter into OutputFormatter and TextOutputFormatter 2016-02-12 12:04:18 -08:00
jacalvar fe639f028f [Fixes 3961] Consider InputFormatter behavior when we can't read the charset
* Broken InputFormatter into InputFormatter and TextInputFormatter
* Added an exception to ModelState inside ReadAsync on TextInputFormatter
  when we can't find a valid encoding to read the body.
2016-02-05 10:42:36 -08:00
N. Taylor Mullen 3be7fbdf9f Rename AspNet 5 file contents.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:18:33 -08:00
N. Taylor Mullen 6a6c8ca544 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:17:07 -08:00