Skip to content

Instantly share code, notes, and snippets.

@snowgooseyk
Last active August 29, 2015 14:09
Show Gist options
  • Save snowgooseyk/45c74565b25d78e89387 to your computer and use it in GitHub Desktop.
Save snowgooseyk/45c74565b25d78e89387 to your computer and use it in GitHub Desktop.
Equivalent of Backbone#emulateHTTP on AngularJS
angular.module('App',[])
.factory('emulateHttpInterceptor', ($q) ->
{
request: (config) ->
method = config.method.toUpperCase()
if method in ['DELETE','PUT']
config.method = 'POST'
config.headers['X-HTTP-Method-Override'] = method
config
}
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment