Skip to content

Instantly share code, notes, and snippets.

@ayamomiji
Created December 4, 2013 16:40
Show Gist options
  • Save ayamomiji/7790850 to your computer and use it in GitHub Desktop.
Save ayamomiji/7790850 to your computer and use it in GitHub Desktop.
make $http to support patch method
module = angular.module(...)
module.config ($httpProvider, $provide) ->
$httpProvider.defaults.headers.patch = {'Content-Type': 'application/json'}
$provide.decorator '$http', ($delegate) ->
$delegate.patch = (url, config) ->
$delegate(angular.extend(config or {}, method: 'patch', url: url))
$delegate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment