function createMock(assert, oPayload, sTextStatus, mResponseHeaders) {
		var jqXHR = new jQuery.Deferred();

		Promise.resolve().then(function () {
			jqXHR.resolve(oPayload, sTextStatus, { // mock jqXHR for success handler
				getResponseHeader : function (sName) {
					mResponseHeaders = mResponseHeaders || {
							"OData-Version" : "4.0"
						};
					// Note: getResponseHeader treats sName case insensitive!
					switch (sName) {
						case "Content-Type":
							return mResponseHeaders["Content-Type"] || null;
						case "DataServiceVersion":
							return mResponseHeaders["DataServiceVersion"] || null;
						case "ETag":
							return mResponseHeaders["ETag"] || null;
						case "OData-Version":
							return mResponseHeaders["OData-Version"] || null;
						case "SAP-ContextId":
							return mResponseHeaders["SAP-ContextId"] || null;
						case "SAP-Http-Session-Timeout":
							return mResponseHeaders["SAP-Http-Session-Timeout"] || null;
						case "sap-messages":
							return mResponseHeaders["sap-messages"] || null;
						case "X-CSRF-Token":
							return mResponseHeaders["X-CSRF-Token"] || null;
						default:
							assert.ok(false, "unexpected getResponseHeader(" + sName + ")");
					}
				}
			});
		});

		return jqXHR;
	}
/**
	 * Creates a mock for jQuery's XHR wrapper.
	 *
	 * @param {object} assert
	 *   QUnit assert
	 * @param {object} oPayload
	 *   the response payload
	 * @param {string} sTextStatus
	 *   the XHR's status as text
	 * @param {object} mResponseHeaders
	 *   the header attributes of the response; supported header attributes are "Content-Type",
	 *   "DataServiceVersion", "ETag", "OData-Version", "SAP-ContextId", "sap-messages" and
	 *   "X-CSRF-Token" all with default value <code>null</code>; if no response headers are given
	 *   at all the default value for "OData-Version" is "4.0";
	 * @returns {object}
	 *   a mock for jQuery's XHR wrapper
	 */
Creates a mock for jQuery's XHR wrapper.
Creates a mock for jQuery ' s XHR wrapper .
function createMock(assert, oPayload, sTextStatus, mResponseHeaders) {
		var jqXHR = new jQuery.Deferred();
		Promise.resolve().then(function () {
			jqXHR.resolve(oPayload, sTextStatus, { 
				getResponseHeader : function (sName) {
					mResponseHeaders = mResponseHeaders || {
							"OData-Version" : "4.0"
						};
					switch (sName) {
						case "Content-Type":
							return mResponseHeaders["Content-Type"] || null;
						case "DataServiceVersion":
							return mResponseHeaders["DataServiceVersion"] || null;
						case "ETag":
							return mResponseHeaders["ETag"] || null;
						case "OData-Version":
							return mResponseHeaders["OData-Version"] || null;
						case "SAP-ContextId":
							return mResponseHeaders["SAP-ContextId"] || null;
						case "SAP-Http-Session-Timeout":
							return mResponseHeaders["SAP-Http-Session-Timeout"] || null;
						case "sap-messages":
							return mResponseHeaders["sap-messages"] || null;
						case "X-CSRF-Token":
							return mResponseHeaders["X-CSRF-Token"] || null;
						default:
							assert.ok(false, "unexpected getResponseHeader(" + sName + ")");
					}
				}
			});
		});
		return jqXHR;
	}
function createMock ( assert , oPayload , sTextStatus , mResponseHeaders ) { var jqXHR = new jQuery . Deferred ( ) ; Promise . resolve ( ) . then ( function ( ) { jqXHR . resolve ( oPayload , sTextStatus , { getResponseHeader : function ( sName ) { mResponseHeaders = mResponseHeaders || { "OData-Version" : "4.0" } ; switch ( sName ) { case "Content-Type" : return mResponseHeaders [ "Content-Type" ] || null ; case "DataServiceVersion" : return mResponseHeaders [ "DataServiceVersion" ] || null ; case "ETag" : return mResponseHeaders [ "ETag" ] || null ; case "OData-Version" : return mResponseHeaders [ "OData-Version" ] || null ; case "SAP-ContextId" : return mResponseHeaders [ "SAP-ContextId" ] || null ; case "SAP-Http-Session-Timeout" : return mResponseHeaders [ "SAP-Http-Session-Timeout" ] || null ; case "sap-messages" : return mResponseHeaders [ "sap-messages" ] || null ; case "X-CSRF-Token" : return mResponseHeaders [ "X-CSRF-Token" ] || null ; default : assert . ok ( false , "unexpected getResponseHeader(" + sName + ")" ) ; } } } ) ; } ) ; return jqXHR ; }
Creates a mock for jQuery's XHR wrapper.
Creates a mock for jQuery ' s XHR wrapper .
// mock jqXHR for success handler // Note: getResponseHeader treats sName case insensitive!