src/sap.ui.core/src/sap/ui/thirdparty/RequestRecorder.js
function(filename, options) {
			_private.oLog.info(sModuleName + " - Record");
			if (window.XMLHttpRequest.name === 'FakeXMLHttpRequest') {
				_private.oLog.warning(sModuleName + " - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective");
			}
			if (_private.isRecordStarted()) {
				_private.oLog.error(sModuleName + " - RequestRecorder is already recording, please stop first...");
				return;
			}
			_private.init(options);

			_private.sFilename = filename;
			_private.bIsRecording = true;

			// Overwrite the open method to get the required request parameters (method, URL, headers) and assign
			// a group name if provided.
			_private.mXhrNativeFunctions.open = window.XMLHttpRequest.prototype.open;
			window.XMLHttpRequest.prototype.open = function() {
				this._requestParams = this._requestParams || {};
				this._requestParams.method = arguments[0];
				this._requestParams.url = arguments[1];
				this._requestParams.customGroupName = _private.fnCustomGroupNameCallback();
				this._requestParams.headers = this._requestParams.headers || [];
				_private.mXhrNativeFunctions.open.apply(this, arguments);
			};

			// Overwrite the setRequestHeader method to record the request headers.
			_private.mXhrNativeFunctions.setRequestHeader = window.XMLHttpRequest.prototype.setRequestHeader;
			window.XMLHttpRequest.prototype.setRequestHeader = function(sHeaderName, sHeaderValue) {
				this._requestParams = this._requestParams || { headers: [] };
				this._requestParams.headers.push({
					name: sHeaderName,
					value: sHeaderValue
				});
				_private.mXhrNativeFunctions.setRequestHeader.apply(this, arguments);
			};

			// Overwrite the send method to get the response and the collected data from the XMLHttpRequest
			_private.mXhrNativeFunctions.send = window.XMLHttpRequest.prototype.send;
			window.XMLHttpRequest.prototype.send = function() {
				if (!_private.isUrlFiltered(this._requestParams.url, _private.aEntriesUrlFilter)) {
					var fTimestamp = _private.preciseDateNow();

					// If the onreadystatechange is already specified by another application, it is called, too.
					var fnOldStateChanged = this.onreadystatechange;
					this.onreadystatechange = function() {
						if (this.readyState === 4) {
							_private.aRequests.push(_private.prepareRequestForHar(this, fTimestamp));
							_private.oLog.info(
								sModuleName + " - Record XMLHttpRequest. Method: " + this._requestParams.method + ", URL: " + this._requestParams.url
							);
						}
						if (fnOldStateChanged) {
							fnOldStateChanged.apply(this, arguments);
						}
					};
				}
				_private.mXhrNativeFunctions.send.apply(this, arguments);
			};
		}
function(filename, options) {
			_private.oLog.info(sModuleName + " - Record");
			if (window.XMLHttpRequest.name === 'FakeXMLHttpRequest') {
				_private.oLog.warning(sModuleName + " - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective");
			}
			if (_private.isRecordStarted()) {
				_private.oLog.error(sModuleName + " - RequestRecorder is already recording, please stop first...");
				return;
			}
			_private.init(options);

			_private.sFilename = filename;
			_private.bIsRecording = true;

			// Overwrite the open method to get the required request parameters (method, URL, headers) and assign
			// a group name if provided.
			_private.mXhrNativeFunctions.open = window.XMLHttpRequest.prototype.open;
			window.XMLHttpRequest.prototype.open = function() {
				this._requestParams = this._requestParams || {};
				this._requestParams.method = arguments[0];
				this._requestParams.url = arguments[1];
				this._requestParams.customGroupName = _private.fnCustomGroupNameCallback();
				this._requestParams.headers = this._requestParams.headers || [];
				_private.mXhrNativeFunctions.open.apply(this, arguments);
			};

			// Overwrite the setRequestHeader method to record the request headers.
			_private.mXhrNativeFunctions.setRequestHeader = window.XMLHttpRequest.prototype.setRequestHeader;
			window.XMLHttpRequest.prototype.setRequestHeader = function(sHeaderName, sHeaderValue) {
				this._requestParams = this._requestParams || { headers: [] };
				this._requestParams.headers.push({
					name: sHeaderName,
					value: sHeaderValue
				});
				_private.mXhrNativeFunctions.setRequestHeader.apply(this, arguments);
			};

			// Overwrite the send method to get the response and the collected data from the XMLHttpRequest
			_private.mXhrNativeFunctions.send = window.XMLHttpRequest.prototype.send;
			window.XMLHttpRequest.prototype.send = function() {
				if (!_private.isUrlFiltered(this._requestParams.url, _private.aEntriesUrlFilter)) {
					var fTimestamp = _private.preciseDateNow();

					// If the onreadystatechange is already specified by another application, it is called, too.
					var fnOldStateChanged = this.onreadystatechange;
					this.onreadystatechange = function() {
						if (this.readyState === 4) {
							_private.aRequests.push(_private.prepareRequestForHar(this, fTimestamp));
							_private.oLog.info(
								sModuleName + " - Record XMLHttpRequest. Method: " + this._requestParams.method + ", URL: " + this._requestParams.url
							);
						}
						if (fnOldStateChanged) {
							fnOldStateChanged.apply(this, arguments);
						}
					};
				}
				_private.mXhrNativeFunctions.send.apply(this, arguments);
			};
		}
function ( filename , options ) { _private . oLog . info ( sModuleName + " - Record" ) ; if ( window . XMLHttpRequest . name === 'FakeXMLHttpRequest' ) { _private . oLog . warning ( sModuleName + " - Sinon FakeXMLHttpRequest is enabled by another application, recording could be defective" ) ; } if ( _private . isRecordStarted ( ) ) { _private . oLog . error ( sModuleName + " - RequestRecorder is already recording, please stop first..." ) ; return ; } _private . init ( options ) ; _private . sFilename = filename ; _private . bIsRecording = true ; // Overwrite the open method to get the required request parameters (method, URL, headers) and assign // a group name if provided. _private . mXhrNativeFunctions . open = window . XMLHttpRequest . prototype . open ; window . XMLHttpRequest . prototype . open = function ( ) { this . _requestParams = this . _requestParams || { } ; this . _requestParams . method = arguments [ 0 ] ; this . _requestParams . url = arguments [ 1 ] ; this . _requestParams . customGroupName = _private . fnCustomGroupNameCallback ( ) ; this . _requestParams . headers = this . _requestParams . headers || [ ] ; _private . mXhrNativeFunctions . open . apply ( this , arguments ) ; } ; // Overwrite the setRequestHeader method to record the request headers. _private . mXhrNativeFunctions . setRequestHeader = window . XMLHttpRequest . prototype . setRequestHeader ; window . XMLHttpRequest . prototype . setRequestHeader = function ( sHeaderName , sHeaderValue ) { this . _requestParams = this . _requestParams || { headers : [ ] } ; this . _requestParams . headers . push ( { name : sHeaderName , value : sHeaderValue } ) ; _private . mXhrNativeFunctions . setRequestHeader . apply ( this , arguments ) ; } ; // Overwrite the send method to get the response and the collected data from the XMLHttpRequest _private . mXhrNativeFunctions . send = window . XMLHttpRequest . prototype . send ; window . XMLHttpRequest . prototype . send = function ( ) { if ( ! _private . isUrlFiltered ( this . _requestParams . url , _private . aEntriesUrlFilter ) ) { var fTimestamp = _private . preciseDateNow ( ) ; // If the onreadystatechange is already specified by another application, it is called, too. var fnOldStateChanged = this . onreadystatechange ; this . onreadystatechange = function ( ) { if ( this . readyState === 4 ) { _private . aRequests . push ( _private . prepareRequestForHar ( this , fTimestamp ) ) ; _private . oLog . info ( sModuleName + " - Record XMLHttpRequest. Method: " + this . _requestParams . method + ", URL: " + this . _requestParams . url ) ; } if ( fnOldStateChanged ) { fnOldStateChanged . apply ( this , arguments ) ; } } ; } _private . mXhrNativeFunctions . send . apply ( this , arguments ) ; } ; }
Start recording with a desired filename and the required options.

@param {string|object} filename The name of the har file to be recorded.
@param {object} [options] Contains optional parameters to config the RequestRecorder:
{function} [options.customGroupNameCallback] A callback is used to determine the custom groupname of the current XMLHttpRequest. If the callback returns a falsy value, the default groupname is used.
boolean} [options.disableDownload] Set this flag to true if you don´t want to download the recording after the recording is finished. This parameter is only used for testing purposes.
{boolean} [options.promptForDownloadFilename] Activates a prompt popup after stop is called to enter a desired filename.
{array|RegExp} [options.entriesUrlFilter] A list of regular expressions, if it matches the URL the request-entry is filtered.
Start recording with a desired filename and the required options .