You can use the beforeSend callback from jQuery.ajax:
amplify.request.define( "foo", "ajax", {
url: "path/to/resource",
beforeSend: function( xhr ) {
xhr.setRequestHeader( "X-Amplify-Request", "bar" );
}
});
See
http://api.jquery.com/jQuery.ajax for a full set of options that work with amplify.request's ajax request type.
Alternatively, you can hook into the request.before.ajax message, though you'd need to filter based on the resource id:
amplify.subscribe( "request.before.ajax", function( resource, settings, ajaxSettings, xhr ) {
if ( resource.resourceId === "foo" ) {
xhr.setRequestHeader( "X-Amplify-Request", "bar" );
}
});