Ok, got it.
in amplifications this section caught my attention
beforeSend : function( _xhr, _ajaxSettings ) { xhr = _xhr; ajaxSettings = _ajaxSettings; var ret = defnSettings.beforeSend ? defnSettings.beforeSend.call( this, ampXHR, ajaxSettings ) : true; return ret && amplify.publish( "request.before.ajax", defnSettings, settings, ajaxSettings, ampXHR ); } });
code>
note that it will call beforeSend if it is specified, otherwise the var ret parameter is set to true
if set to true, it will publish "request.before.ajax"
down in the file, the gain listens for this message
amplify.subscribe( "request.before.ajax", function( resource, settings, ajaxSettings, ampXHR ) { var _success = ampXHR.success, _error = ampXHR.error, decoder = $.isFunction( resource.decoder ) ? resource.decoder : resource.decoder in amplify.request.decoders ? amplify.request.decoders[ resource.decoder ] : amplify.request.decoders._default; if ( !decoder ) { return; } function success( data, status ) { _success( data, status ); } function error( data, status ) { _error( data, status ); } ampXHR.success = function( data, status ) { decoder( data, status, ampXHR, success, error ); }; ampXHR.error = function( data, status ) { decoder( data, status, ampXHR, success, error ); };
});
code>
therefore, if you have beforeSend and if it does not return true, the message will never be published and the decoders will never be deleted!
decision?
returns true from beforeSend function
amplify.request.define("testRequest", "ajax", { url: "/echo/json/", dataType: 'json', type: 'POST', decoder: function(data, status, xhr, success, error) { console.log('decoder fired'); $('.messages').append('<div>decoder fired </div>'); success(data); }, beforeSend: function(xhr){
});
code>
works like a charm! Hope this helps someone else try to figure it out!