summaryrefslogtreecommitdiffstats
path: root/coffee/lib/owncloud.coffee
blob: 30d593536127dab49a0c71b1b8d7a6a230bbf81d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
###
# ownCloud
#
# @author Bernhard Posselt
# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com>
#
# This file is licensed under the Affero General Public License version 3 or
# later.
#
# See the COPYING-README file
#
###

###
# Various config stuff for owncloud
###
angular.module('OC', []).config ['$httpProvider', ($httpProvider) ->

	# Always send the CSRF token by default
	$httpProvider.defaults.get['requesttoken'] = oc_requesttoken
	$httpProvider.defaults.post['requesttoken'] = oc_requesttoken
	
	# needed because crap PHP does not understand JSON
        $httpProvider.defaults.post['Content-Type'] =
                'application/x-www-form-urlencoded'
        $httpProvider.defaults.get['Content-Type'] =
                'application/x-www-form-urlencoded'
	$httpProvider.defaults.transformRequest = (data) ->
		if angular.isDefined(data)
			return data
		else
			return $.param(data)
]