Skip to content

Commit a730682

Browse files
committed
MC-5538: Search terms are not cached in case of form_key present in the request
1 parent a903e8c commit a730682

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontCatalogSearchActionGroup.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<submitForm selector="#search_mini_form" parameterArray="['q' => '{{phrase}}']" stepKey="fillQuickSearch" />
1717
<seeInCurrentUrl url="{{StorefrontCatalogSearchPage.url}}" stepKey="checkUrl"/>
1818
<seeInTitle userInput="Search results for: '{{phrase}}'" stepKey="assertQuickSearchTitle"/>
19+
<dontSeeInCurrentUrl url="form_key=" stepKey="checkUrlFormKey"/>
1920
<see userInput="Search results for: '{{phrase}}'" selector="{{StorefrontCatalogSearchMainSection.SearchTitle}}" stepKey="assertQuickSearchName"/>
2021
</actionGroup>
2122

lib/web/mage/common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ define([
2121
form = $(e.target),
2222
formKey = $('input[name="form_key"]').val();
2323

24-
if (formKey && !form.find('input[name="form_key"]').length) {
24+
if (formKey && !form.find('input[name="form_key"]').length && form[0].method !== 'get') {
2525
formKeyElement = document.createElement('input');
2626
formKeyElement.setAttribute('type', 'hidden');
2727
formKeyElement.setAttribute('name', 'form_key');

0 commit comments

Comments
 (0)