Skip to content

Commit

Permalink
chore(storefront): STRF-11941 Helper should just return nonce in quot…
Browse files Browse the repository at this point in the history
…es (#306)
  • Loading branch information
huntario authored May 29, 2024
1 parent eee9306 commit fe270f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helpers/nonce.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const factory = globals => {
return function() {
const params = globals.getRequestParams();
if (params && params.security && params.security.nonce) {
return new globals.handlebars.SafeString(` nonce="${params.security.nonce}"`);
return new globals.handlebars.SafeString(`"${params.security.nonce}"`);
}
return ''
};
Expand Down
4 changes: 2 additions & 2 deletions spec/helpers/nonce.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const {testRunner, buildRenderer, randomString} = require('../spec-helpers');
describe('nonce helper', function () {
const context = {}

it('should render a nonce html attribute with the correct value from request params', function (done) {
it('should render a nonce in quotes with the correct value from request params', function (done) {
const requestParams = {
security: {
nonce: randomString()
Expand All @@ -17,7 +17,7 @@ describe('nonce helper', function () {
runTestCases([
{
input: '{{nonce}}',
output: ' nonce="' + requestParams.security.nonce + '"',
output: '"' + requestParams.security.nonce + '"',
},
], done);
});
Expand Down

0 comments on commit fe270f7

Please sign in to comment.