Commit Graph

346 Commits

Author SHA1 Message Date
Kiran Challa 35f7d3f09c Added tests to verify that RazorPages and FuzzyMatching with Head requests work 2018-05-01 14:01:00 -07:00
Pranav K 5d5222cdd8 Introduce BindPropertiesAttribute
* Allow controller and Razor Page models to be annotated with BindPropertiesAttribute
* Disallow BindPropertyAttribute from being declared on types.
* Do not allow arbitrary binding attributes to be applied to Razor Page models.

Fixes #7686
2018-04-20 14:32:14 -07:00
Pranav K 60a9810268 Allow PartialTagHelper to specify a null model. Fixes #7667 2018-04-18 14:16:44 -07:00
Kiran Challa faca3da42f Ensure ViewData is set on PageResult after a handler method executes
[Fixes #7665] Initializing PageResult.Page as part of result execution breaks Identity UI
2018-04-18 11:44:04 -07:00
Javier Calvarro Nelson e781cd38cf [Fixes #7635] Provide a way to configure HTTP Client instances 2018-04-17 12:52:56 -07:00
Javier Calvarro Nelson e0b4c13895 [Fixes #7587] Default to Development environment in tests 2018-04-17 12:52:51 -07:00
Kiran Challa e52933e4e3 Removed UrlTestEncoder references in tests
This is because with the following commit, Routing no longer depends on DI to get a UrlEncoder and always uses UrlEncoder.Default.
4184b2406d
2018-04-14 06:08:20 -07:00
Kiran Challa d5e044f693 [Fixes #7373] Assigning to the context's Result property, when implementing IPageFilter, causes an exception 2018-04-13 15:11:44 -07:00
Pranav K d995b0418a Allow BindPropertyAttribute to be specified on controller classes
Fixes #7350
2018-04-13 13:58:44 -07:00
Pranav K c7559e1ff4
Merge pull request #7590 from aspnet/release/2.1
Release/2.1
2018-04-02 09:49:14 -07:00
Pranav K c515cece8e Use ModelMetadataProvider to infer BindingSource on application model 2018-04-02 09:48:49 -07:00
Pranav K 133dd964ab Introduce ViewDataAttribute
Allow properties on controllers, Razor Page and Razor Page models annotatted with [ViewDataAttribute]
to populate ViewDataDictionary

Fixes https://github.com/aspnet/Mvc/issues/6525
2018-03-30 14:19:52 -07:00
Pranav K f8e315d03d
CompiledPageRouteModelProvider should de-dup descriptors
Fixes #7543
2018-03-28 11:24:49 -07:00
Kiran Challa 0c084fa28a [Fixes #7518] NullReferenceException thrown when Controller method uses Guid parameter default value 2018-03-27 05:22:20 -07:00
Doug Bunting 5e245da326
Add compatibility switch controlling parameter metadata and top-level validation
- #7413 part 1 of 2
- made all `ModelMetadataProvider` and `ObjectModelValidator`-specific code conditional
  - fortunately, `MvcOptions` easy to get; affected code is primarily `internal` or pub-`Internal`
  - remove unnecessary `ModelMetadataProvider` use in `ApiBehaviorApplicationModelProvider`
- run integration and functional tests with `CompatibilityVersion.Version_2_1`
  - functional test change depends on @javiercn's recent #7541 fix
  - remove test code now redundantly turning compatibility switches on

nits:
- correct spelling errors in `CompatibilitySwitch`
- take VS suggestions, mostly in test code
- rename methods in `ControllerBinderDelegateProviderTest` to match current API
- slightly refactor in `ApiBehaviorApplicationModelProvider`
2018-03-26 12:29:04 -07:00
Javier Calvarro Nelson 51784bb2d6
[Fixes #7541] Per-test class customization should not remove global (per-fixture) customization 2018-03-24 18:33:48 -07:00
N. Taylor Mullen e94d77c47f Add model attribute for PartialTagHelper.
- The model attribute is used to define any object based model to be passed to a `TagHelper`. It enables scenarios when users want to pass in `new` poco types.
- Added unit tests for the new `ResolveModel` method in `PartialTagHelper`.
- Added a single functional test to verify the end-to-end.

#7374
2018-03-23 16:13:55 -07:00
Ryan Nowak 1ff5bdca79 Set model prefix for [ApiController]
Infers the 'empty' model prefix for complex types that are read from the value
providers. This gives us better defaults when using the parameter object
pattern with respect to swagger/API explorer.
2018-03-23 14:49:54 -07:00
Ryan Nowak 14429721d9 Make handler selector more flexible
Some details of this pending discussion, but this is a new 2.1 change
and compatibility switch in the spirit of making pages handler selection
less error-prone.

In particular we don't want anyone to have to define HEAD to do the
trivial thing. This currently routes all 'safe' HTTP methods to the GET
handler and all other HTTP methods to the POST handler.

This is technically not the correct thing to do for OPTIONS and TRACE,
so we might still do something different.

The tests will change a little depending on exactly what we decide to
do, but this is the main idea of the change.
2018-03-23 14:22:48 -07:00
Pranav K d6176ac7de ApplicationPartFactory: The works 2018-03-21 15:40:15 -07:00
Javier Calvarro Nelson 908e7a863b Improvements to the MVC testing package
* Clean up unnecessary workarounds on the build project.
* Remove the need to specify the content root relative to the solution
  and use a solution based on an assembly level attribute on the test
  assembly created at build time.
* Remove non parameterless constructors.
* Add support for creating specialized factories from the base factory
  and keep track of "child" factories for disposal.
* Add support for creating clients that handle cookies and redirects
  automatically.
2018-03-19 12:19:45 -07:00
Pranav K ae2d82c748 Remove FiltersWebSite 2018-03-16 16:54:10 -07:00
Ryan Brandenburg 9b4b373014 Remove IErrorDescriptionFactory 2018-03-07 13:09:13 -08:00
Jass Bagga f3ffdada95
Remove problem+json Content-Type (#7440)
Addresses #7344
2018-03-06 13:46:40 -08:00
Pranav K 06e40252a0 Add support for top level validation to Razor Pages 2018-02-14 14:39:25 -08:00
Jass Bagga d27e66a8fc
Initialize ViewContext for TagHelperComponentTagHelper (#7326)
Addresses #7017
2018-02-06 16:07:38 -08:00
Javier Calvarro Nelson 7127bb5dbb Add DeclaredModelType to Razor pages
* This allows razor pages to override their model type with a model that
  extends the declared model type through the page application model.
2018-01-25 16:00:54 -08:00
Pranav K b30020a655 PartialTagHelper should not fallback to the current page's model if asp-for expression exists
Fixes #7295
2018-01-25 11:06:40 -08:00
Artak Mkrtchyan 4f3e0966d9 Enabling antiforgery tests, which were disabled because of the #7040 issue 2018-01-23 19:16:24 -08:00
Pranav K ebdb3c650a Smooth rough ApiBehavior edges
Fixes #7262
2018-01-22 09:53:21 -08:00
Pranav K f0ae0ce528 Add PageConvention overloads for areas
Fixes #7246
2018-01-18 08:21:21 -08:00
Pranav K ab3134e373 Support conflict resolution when multiple precompiled views have the same path
Fixes #7223
2018-01-16 08:04:39 -08:00
Pranav K 946b64143e Allow override routes on Pages
Fixes #6605
2018-01-12 15:57:13 -08:00
Ryan Nowak d342ebf8c8 Use compatibility switch for auth filters 2018-01-11 17:42:32 -08:00
Ajay Bhargav Baaskaran b20e35e76a Set RelativePhysicalPath in FileProviderRazorProjectItem 2018-01-11 13:20:17 -08:00
Jass Bagga 9438a453b0
Do not serve response body for HEAD requests (#7230)
Addresses #7208
2018-01-11 12:19:43 -08:00
Kiran Challa 2aae8774f6 [Fixes 7139] Add format filter mapping for xml formatters 2018-01-10 15:18:37 -08:00
Pranav K b196708a3e Merge tag '2.0.2' into dev 2018-01-10 10:02:54 -08:00
Ryan Nowak 75e3ed952b Update functional tests 2018-01-08 19:55:01 -08:00
Ryan Nowak d58d0f917f Add support for recompilation 2018-01-08 15:26:20 -08:00
Hao Kung 73bd09dc1c Add CombineAuthorizeFilters option 2018-01-08 11:59:30 -08:00
ASP.NET CI 2e73bab2a4 Move option for JSON errors to MvcJsonOptions
This was in the wrong place - JSON formatters have their own options
type already.

Moved the option to MvcJsonOptions and updated the naming + defaults to
reflect our plan.

Also did a bunch of general cleanup on these tests, which were a bit
sloppy.
2018-01-07 21:48:58 -08:00
Doug Bunting bab520f4dd Use latest `Microsoft.AspNet.WebApi.Client` package
- #5822
- update `Microsoft.AspNet.WebApi.Client` package version
- remove remaining few `$(PackageTargetFallback)` settings
- remove .NET Standard-specific files
  - they duplicate what Microsoft.AspNet.WebApi.Client now provides
  - necessary only if cross-compiling a PCL version of the WebApiCompatShim
  - add type forwarding for the removed `public` types
- reenable .NET Framework WebApiCompatShim tests
- add breaking change record for `MediaTypeFormatterMatchRanking` value change
  - version of this type in the shim lacked the `MatchOnRequestWithMediaTypeMapping` value
2018-01-05 16:42:28 -08:00
Kiran Challa 9fd60ff864 Marked CookieTempDataProvider's cookie as non-essential
[Fixes #7160] Determine if the temp data cookie is considered essential
2018-01-05 15:41:01 -08:00
Pranav K 0e21bab125 React to naming change in Razor 2018-01-03 12:38:16 -08:00
Pranav K 350c4ec4f6
Introduce IAlwaysRunResultFilter \ IAsyncAlwaysRunResultFilter (#7120)
* Introduce IAlwaysRunResultFilter \ IAsyncAlwaysRunResultFilter

Fixes #7105
2017-12-22 10:52:52 -08:00
Pranav K dfa085afaf Add support for areas to Razor Pages
Fixes #6926
2017-12-19 15:03:05 -08:00
Kiran Challa 7e26af908e [Fixes #6514] Add default ctor overload to AuthorizeFilter 2017-12-12 14:07:02 -08:00
Nate McMaster 67f48064ce Skip additional flaky tests. See aspnet/Mvc#7122 2017-12-11 15:38:30 -08:00
N. Taylor Mullen 7cea779b7a Update JsonHelper to escape HTML.
- This functionality can be disabled by setting the `Switch.Microsoft.AspNetCore.Mvc.AllowJsonHtml` switch in an app.config.
- Updated tests to react to this new behavior.
- Exposed a new `PublicSerializerSettings` property on `JsonOutputFormatter` so we can accurately copy settings from the used output formatter in `JsonHelper`.
2017-12-07 16:12:43 -08:00