I have interceptor service to add a header to all my requests. However occasionally I don't need this header, so following Angular's documentation I set it to undefined:
$http({
    url: 'https://hooks.slack.com/services/',
    method: 'POST',
    data: {test: 'test message'},
    headers: {
        'my-header': undefined
    }
})
But I still get Request header field my-header is not allowed by Access-Control-Allow-Headers in preflight response
What am I doing wrong?
UPDATE:
I tried setting headers to {}, I tried setting Content-type to text/plain and application/x-www-form-urlencoded which shouldn't be triggering the preflight. But apparently because of custom headers which is what my-header is the pre-flight is still issued.
