[MGNLWCS-103] ShoppingCartModel should set Cache-Control to no-cache Created: 06/Jan/15  Updated: 03/Mar/15  Resolved: 06/Feb/15

Status: Closed
Project: Websphere Commerce Integration
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0.5, 1.1

Type: Bug Priority: Major
Reporter: Milan Divilek Assignee: AntonĂ­n Juran
Resolution: Fixed Votes: 0
Labels: quickwin
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Pages where shopping cart is displayed should not be cached.
info.magnolia.wcs.integration.model.ShoppingCartModel should set MgnlContext.getWebContext().getResponse().setHeader("Cache-Control", "no-cache");



 Comments   
Comment by Milan Divilek [ 06/Feb/15 ]

Reopen:
1. Please check if context is webContext in info.magnolia.wcs.integration.model.ShoppingCartModel.

if (MgnlContext.isWebContext()) {
    MgnlContext.getWebContext().getResponse().setHeader("Cache-Control", "no-cache");
}

2. It's unnecessary to introduce mockrunner-servlet dependency. Test can be easily done with mockito.

- MockHttpServletResponse response = new MockHttpServletResponse();
+ HttpServletResponse response = mock(HttpServletResponse.class);
- boolean beforeExecute = MgnlContext.getWebContext().getResponse().containsHeader("Cache-Control");
- boolean afterExecute = MgnlContext.getWebContext().getResponse().containsHeader("Cache-Control");
- assertFalse(beforeExecute);
- assertTrue(afterExecute);
+ verify(response).setHeader("Cache-Control", "no-cache");
Generated at Mon Feb 12 11:13:18 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.