Commit Graph

2755 Commits

Author SHA1 Message Date
Doug Bunting c74a945dda
Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture` (#8674)
* Convert `RouteValueDictionary` values to `string` using `CultureInfo.InvariantCulture`
- #8578
- user may override this choice in one case:
  - register a custom `IValueProviderFactory` to pass another `CultureInfo` into the `RouteValueProvider`
- values are used as programmatic tokens outside `RouteValueProvider`

nits:
- take VS suggestions in changed classes
- take VS suggestions in files I had open :)
2018-10-30 20:09:17 -07:00
Pranav K 734b919b02 Respect SuppressInferBindingSourcesForParameters
Fixes https://github.com/aspnet/Mvc/issues/8657
2018-10-30 14:37:21 -07:00
Pranav K 35d2ab37f7 Allow passing a dictionary to ValidationProblemDetails
Fixes https://github.com/aspnet/Mvc/issues/8645
2018-10-29 09:56:17 -07:00
Doug Bunting 0b6932dc15 Quick fix: Clean up test warnings
- avoid "Skipping test case with duplicate ID" messages
  - xUnit gets confused when `[Theory]`s are overridden
- avoid "falling back to single test case" messages
  - fix inspired by aspnet/SignalR#1820
2018-10-28 21:18:57 -07:00
James Newton-King 6bb292cfcc
Add test for metadata precedence (#8642) 2018-10-27 07:59:15 +13:00
Pranav K 5656e7f455 React to CORS changes 2018-10-26 11:10:54 -07:00
Pranav K 2544926b2f Provide a convenience API to configure ApiBehaviorOptions 2018-10-24 10:10:33 -07:00
James Newton-King 40959a97e7
Fix link generation of routes with default values (#8616) 2018-10-23 16:10:43 +13:00
Ryan Nowak 76a30b0911 Remove LinkGenerationTemplate
This doesn't really accomplish our goals for 2.2 - I don't have a clear
scenario where I would tell a developer to use this VS something else.
Will reevaluate in 3.0
2018-10-21 15:39:59 -07:00
Patrick Westerhoff ddbe0fef26 Allow custom handling of antiforgery failures
To enable custom handling of antiforgery validation failures, use an
`AntiforgeryValidationFailedResult` which is just a `BadRequestResult`
but allows to be identified explicitly inside always-running result
filters using the `IAntiforgeryValidationFailedResult` marker interface.
2018-10-19 13:47:08 -07:00
Pranav K 8a183bb4f4 Allow serving Razor files with leading underscore
Fixes https://github.com/aspnet/Mvc/issues/8617
2018-10-19 13:43:35 -07:00
Pranav K 27e75e7a51
Add a switch to allow turning on ValidationVisitor shortcircuiting (#8599) 2018-10-17 15:47:01 -07:00
Pranav K fb57810f29 Shortcircuit validation when using default validator providers and no validation metadata is discovered
Fixes https://github.com/aspnet/Mvc/issues/5887
2018-10-12 14:47:06 -07:00
Pranav K a40c1f2d02 Use compat flag to drive XML ProblemDetails formatting 2018-10-12 14:15:28 -07:00
Pranav K 164d14064c Use casing for ProblemDetails that specified by RFC
* Use JsonProperty.MemberName to specify lowercase casing for ProblemDetails properties -
  https://tools.ietf.org/html/rfc7807#section-3
* Use XML NS and lowercase for Xml elements specified by RFC -
  https://tools.ietf.org/html/rfc7807#appendix-A

Fixes https://github.com/aspnet/Mvc/issues/8501
2018-10-12 14:15:28 -07:00
Pranav K f6fc34aff9 React to CORS changes 2018-10-11 12:23:43 -07:00
James Newton-King 9daf5ff7a4
Fix PageRouteTransformerConvention with custom page routes (#8576) 2018-10-10 18:33:30 +13:00
Ryan Nowak 6cee2431f1 React to routing changes 2018-10-08 15:45:32 -07:00
David J. Quiroga 956441aa68 Ignore created URI if Assembly.CodeBase contains a fragment (#8556)
* Fixes #8367
2018-10-08 10:41:04 -07:00
Ryan Nowak 384b814349 React to IEndpointSelectorPolicy changes 2018-10-05 21:03:53 -07:00
Doug Bunting 5bddd226a3
Use Internal.AspNetCore.Sdk as an MSBuild SDK
- should resolve issues with occasional strange MSBuild caching issues in this repo
- modeled after aspnet/Scaffolding#905
- follows aspnet/BuildTools#729 recommendation to check in global.config file
  - see also Microsoft/msbuild#2914
- use newer KoreBuild
  - `.\build.cmd -update /t:noop`
2018-10-04 15:12:38 -07:00
Pranav K 153165f9ad
Handle OPTIONS requests without a handler in Razor Pages (#8528)
* Handle OPTIONS requests without a handler in Razor Pages

Fixes #7438
2018-10-04 12:25:36 -07:00
James Newton-King 94101a9cde
Add PageRouteTransformerConvention (#8541) 2018-10-04 17:34:26 +13:00
James Newton-King 7854d65c11
Support page parameter in attribute route (#8530) 2018-10-04 14:39:40 +13:00
Pranav K a48e75dfb4
Implicitly set content type for ObjectResults containing ProblemDetails (#8512)
* Implicitly set content type for ObjectResults containing ProblemDetails

Fixes #8467
2018-10-02 10:24:38 -07:00
Ryan Nowak 3667b0481a React to routing API changes
Reaction for: https://github.com/aspnet/Routing/pull/822
2018-09-30 14:26:06 -07:00
Ryan Nowak cb1393cbb1 Adding functional tests for LinkGenerator 2018-09-29 20:34:48 -07:00
Pranav K ccb6579cd7
Do not return ProblemDetails for < 4xx status codes
Fixes #8504
2018-09-28 10:33:45 -07:00
Pranav K 8311fd870b
Include the response type in ProducesResponseType for client errors (#8490)
* Include the response type in ProducesResponseType for client errors

* Refactor ActualApiResponseMetadata discovery in to a separate more manageable type
* Annotate action result ctors and helper methods that specify the "object" value with attribute
* Modify the discovery of parameters to match ActionResultObjectValueAttribute and ActionResultStatusCodeAttribute by name
  to allow users to write and annotate custom helper methods and action results, a la NotNullAttribute.

Fixes #8345
2018-09-26 15:51:49 -07:00
Ryan Nowak 831937c86c Add LinkGenerator extensions for MVC 2018-09-26 09:37:46 -07:00
Pranav K 50cef4822a
Invoke FlushAsync before disposing the HttpResponseWriter in JsonResultExecutor
Fixes #8486
2018-09-24 13:00:56 -07:00
Doug Bunting 5c8dfef15e
Change `CollectionModelBinder` and `ComplexTypeModelBinder` to enforce `[BindRequired]`
- #8180
- add an error when binding fails for top-level model
  - same case as when MVC creates "default" / empty model i.e. `ParameterBinder` can't detect this
- update `CollectionModelBinder` subclasses and the various providers as well
- controlled by existing `MvcOptions.AllowValidatingTopLevelNodes` option

smaller issue:
- change `ModelBinding_MissingBindRequiredMember` resource to mention parameters too
2018-09-21 11:08:16 -07:00
Pranav K 61386d5f67
Reference Microsoft.NET.Sdk.Razor in projects with Razor files 2018-09-20 13:21:45 -07:00
Ryan Nowak 5c4c746797 Reaction PR from routing rename 2018-09-20 10:15:50 -07:00
Pranav K 9c424b7b02
Use content-type specified by ProducesAttribute if no formatter supports it
This allows users to use `ProducesAttribute` to specify the content-type
for action results such as FileStreamResult where the result determines the content type
and the specified value is informational.

Fixes https://github.com/aspnet/Mvc/issues/5701
2018-09-19 13:51:31 -07:00
Pranav K f7da3503d6 Allow Implicit 200 status codes to match Ok result 2018-09-19 12:51:13 -07:00
Pranav K c73b13f544
Cherry-pick @pranavkm's functional test for #7562
- 30a5eda508 / origin/prkrishn/form-file-value-provider

Was:
Design: Use a value provider to allow nested form files

Fixes https://github.com/aspnet/Mvc/issues/7562
2018-09-18 11:44:48 -07:00
Doug Bunting 47d6d4e82c
Update `FormFileModelBinder` to re-add prefix `ParameterBinder` removed incorrectly
- #7562 part 2
- add `OriginalModelName` to `ModelBindingContext`

nit: take VS suggestions, mostly to inline collection initialization in `FormFileModelBinderTest`
2018-09-18 11:44:48 -07:00
Doug Bunting c13e2498a8
Create model in `ComplexTypeModelBinder` if ANY property has a greedy binding source
- #7562 part 1
2018-09-18 11:44:37 -07:00
James Newton-King 8791f9ad0d
Change test parameter transformer to slugify values (#8453) 2018-09-15 09:14:48 +12:00
Pranav K 4b83f7b510
Make FileVersionProvider repleacable
Fixes #6371
2018-09-14 09:14:02 -07:00
Pranav K 233140c33a
Allow IFormFile parameters annotated with [FromForm] to be correctly … (#8452)
* Allow IFormFile parameters annotated with [FromForm] to be correctly bound in ApiControllers

Fixes #8311
2018-09-14 09:06:32 -07:00
Pranav K cb88e906b2 Allow ProducesAttribute to apply along with conventions
Fixes #8389
2018-09-12 13:58:02 -07:00
Pranav K a73d073eea
Allow ApiControlelrAttribute to be applied to assemblies
Fixes #7343
2018-09-12 13:42:22 -07:00
Pranav K 13281613a5
Refactor DefaultPageApplicationModel to use conventions 2018-09-12 12:28:16 -07:00
Simon Cropp 43d4416a1d Fix typos (#8413) 2018-09-12 09:34:45 -07:00
James Newton-King dfae9c208a
Add IParameterTransformer support (#8329) 2018-09-12 21:46:41 +12:00
James Newton-King 105f8b47a1
Fix endpoint support for area/controller/action in attribute route (#8447) 2018-09-12 21:16:50 +12:00
N. Taylor Mullen ec489da586 Add additional logging to diagnose flaky cache tag test.
#8281
2018-09-11 14:09:36 -07:00
James Newton-King 6e27a04bf3
No HttpContext to route constraints in MvcEndpointDataSource (#8436) 2018-09-11 10:12:09 +12:00