Mockjax HTTP error code

http, mockjax

Solution

You can set the status code of the error, in the 'status':

$.mockjax({
  url: '/restful/api',
  // Server 500 error occurred
  status: 500,
  responseTime: 750,
  responseText: 'A text response from the server'
});

Problem

Is it possible to mock HTTP error codes, and other header information using mockjax? ``` $.mockjax({ url: '/some/webservice', dataType: 'html', responseText: '<div>Hello there</div>' }); // Normal ajax request in your application $.ajax({ url: '/some/webservice', dataType: 'html', success: function(html) { alert('You said: ' + html); } }); ``` Alternatively, is there another library that can?

Original source