1/** 2 * Copyright © Magento, Inc. All rights reserved. 3 * See COPYING.txt for license details. 4 */ 5 6// jscs:disable requireDotNotation 7 8define([ 9 'mage/utils/wrapper' 10], function (wrapper) { 11 'use strict'; 12 13 return function (jQuery) { 14 jQuery.ajax = wrapper.wrapSuper(jQuery.ajax, function () { 15 //Moving ReCaptcha value from payload to the header for requests to web API 16 var settings, 17 payload; 18 19 if (arguments.length !== 0) { 20 settings = arguments.length === 1 ? arguments[0] : arguments[1]; 21 } 22 23 if (settings && settings.hasOwnProperty('data')) { 24 //The request has a body, trying to parse JSON data 25 try { 26 payload = JSON.parse(settings.data); 27 } catch (e) { 28 //Not JSON 29 } 30 } 31 32 if (payload && payload.hasOwnProperty('xReCaptchaValue')) { 33 if (!settings.hasOwnProperty('headers')) { 34 settings.headers = {}; 35 } 36 settings.headers['X-ReCaptcha'] = payload.xReCaptchaValue; 37 delete payload['xReCaptchaValue']; 38 settings.data = JSON.stringify(payload); 39 } 40 41 return this._super.apply(this, arguments); 42 }); 43 44 return jQuery; 45 }; 46});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.