-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Includes query string parameters in top-level self link and paging li…
…nks (#698) * Includes query string parameters in top-level self link and paging links * Review feedback: rename QueryParameterDiscovery to QueryParameterParser * Review feedback: Make QueryParameterParser use IRequestQueryStringAccessor; make RequestQueryStringAccessor internal and register as singleton
- Loading branch information
1 parent
e0f5a92
commit 24999c4
Showing
10 changed files
with
173 additions
and
77 deletions.
There are no files selected for viewing
This file contains 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 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 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
5 changes: 2 additions & 3 deletions
5
src/JsonApiDotNetCore/QueryParameterServices/Common/IQueryParameterParser.cs
This file contains 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,15 +1,14 @@ | ||
using JsonApiDotNetCore.Controllers; | ||
using JsonApiDotNetCore.Query; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace JsonApiDotNetCore.Services | ||
{ | ||
/// <summary> | ||
/// Responsible for populating the various service implementations of | ||
/// <see cref="IQueryParameterService"/>. | ||
/// </summary> | ||
public interface IQueryParameterDiscovery | ||
public interface IQueryParameterParser | ||
{ | ||
void Parse(IQueryCollection query, DisableQueryAttribute disabledQuery = null); | ||
void Parse(DisableQueryAttribute disabledQuery = null); | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
src/JsonApiDotNetCore/QueryParameterServices/Common/IRequestQueryStringAccessor.cs
This file contains 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,10 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace JsonApiDotNetCore.QueryParameterServices.Common | ||
{ | ||
public interface IRequestQueryStringAccessor | ||
{ | ||
QueryString QueryString { get; } | ||
IQueryCollection Query { get; } | ||
} | ||
} |
This file contains 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
17 changes: 17 additions & 0 deletions
17
src/JsonApiDotNetCore/QueryParameterServices/Common/RequestQueryStringAccessor.cs
This file contains 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,17 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace JsonApiDotNetCore.QueryParameterServices.Common | ||
{ | ||
internal sealed class RequestQueryStringAccessor : IRequestQueryStringAccessor | ||
{ | ||
private readonly IHttpContextAccessor _httpContextAccessor; | ||
|
||
public QueryString QueryString => _httpContextAccessor.HttpContext.Request.QueryString; | ||
public IQueryCollection Query => _httpContextAccessor.HttpContext.Request.Query; | ||
|
||
public RequestQueryStringAccessor(IHttpContextAccessor httpContextAccessor) | ||
{ | ||
_httpContextAccessor = httpContextAccessor; | ||
} | ||
} | ||
} |
This file contains 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.