http

vuenit.http() | vuenit.mockHttp()

Creates a mock http object. This mimics the pattern of many ajax modules, and axios in particular. The idea is that you would inject a $http property into your Vue component and use it to mock ajax requests in your code.

The returned object is a callable function that takes a configuration object.

var $http = vuenit.http();
$http({
  url : '/api/1',
  method : 'post',
  data : {}
});

Upon receiving a request, http checks for a matching response set via the when method. If it finds one, the response is returned as a promise, otherwise an error is thrown.

http contains a number of methods that will be familiar to most apis...

results matching ""

    No results matching ""