-
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.
Merge pull request #52 from dlcs/feature/19/vary_header
Add vary heade to flat and hierarchical collection GETs
- Loading branch information
Showing
3 changed files
with
51 additions
and
4 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
15 changes: 15 additions & 0 deletions
15
src/IIIFPresentation/API/Infrastructure/Filters/VaryHeaderAttribute.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,15 @@ | ||
using Microsoft.AspNetCore.Mvc.Filters; | ||
using Microsoft.Net.Http.Headers; | ||
|
||
namespace API.Infrastructure.Filters; | ||
|
||
public class VaryHeaderAttribute : ActionFilterAttribute | ||
{ | ||
private static readonly string[] VaryHeaders = ["X-IIIF-CS-Show-Extras", "Authorization"]; | ||
|
||
public override void OnActionExecuted(ActionExecutedContext context) | ||
{ | ||
if (context.Result is not null) | ||
context.HttpContext.Response.Headers.Append(HeaderNames.Vary, VaryHeaders); | ||
} | ||
} |