1//ãªã¯ã¨ã¹ããããã¼ã«CSRFãã¼ã¯ã³ã®æ å ±ã追è¨ãã 2$(document).ready(function(){ 3 $.ajaxSetup({ 4 beforeSend:function(xhr){ 5 xhr.setRequestHeader( 6 'X-CSRF-Token', 7 window.CSRF_TOKEN 8 ); 9 } 10 }); 11}); 12 13//Reactã®fetchã«CSRFãã¼ã¯ã³ã追è¨ãã 14(function(){ 15 16 //fetchæªå¯¾å¿ã®å ´åã¯ä½ãå®è¡ããã«ãªã¿ã¼ã³ 17 if(!window.fetch){ 18 return; 19 } 20 21 //å ã®fetchãæ ¼ç´ 22 const originalFetch = window.fetch; 23 24 window.fetch = function (url, options){ 25 options = options || {}; 26 const method = (options.method || 'GET').toUpperCase(); 27 28 //ã¡ã½ãããå¤å¥ 29 if(['POST','PUT','PATCH','DELETE'].indexOf(method) !== -1){ 30 //CSRFãã¼ã¯ã³ãè¿½è¨ 31 options.headers = { 32 ...(options.headers || {}), 33 'X-CSRF-Token': window.CSRF_TOKEN 34 }; 35 } 36 37 //å ã®fetchãå¼ã³åºã 38 return originalFetch.call( 39 this, 40 url, 41 options 42 ); 43 }; 44})();
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.