$http
1つの特定のリクエストからいくつかのリクエストヘッダーフィールドを削除したい($httpProvider
レベルにないことを意味します)。これらのフィールドは次のとおりです。
- キャッシュ制御
- If-Modified-Since
- リファラー
- X-Requested-With
単一のリクエストでこれを行う方法は?パラメータを使おうとしましtransformRequest
たが、動作させるのに十分な情報が見つかりませんでした。そのような[CoffeeScript]コード:
$scope.logout = ->
$http({
method: 'GET'
url: '/api/logout'
headers: { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' }
transformRequest: (data, headersGetter) ->
console.log data
console.log headersGetter
data
}).success ->
$location.path('editor')
つまり、headersGetterはdata
(私にはまったく何も言わない)であり、transformRequest関数から何を返すかがわかりませんでした。undefined
function (c){a||(a=Nb(b));return c?a[y(c)]||null:a}