This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
AngularJS incorrectly(?) strips away "Content-Type" from headers when "data" is undefined originally but is assigned an object by a TransformRequest function. #7910
Milestone
Here is the relevant chunk of code:
https://github.com/angular/angular.js/blob/master/src/ng/http.js#L609
Scenario
data
. e.g.where
addingRequestTransformer
is something likedata
This request ends up going with
Content-Type: text
because of browsers' default behavior becauseContent-Type
is stripped away by the code referenced above.This reproes on latest Chrome, FF, IE (as expected)
Looking at the immediate surrounding of the $http code, the intent seems to be to send
Content-Type: json
as long asdata
is not undefined which makes me think it should be checked after transforms are applied (i.e. checkingreqData
instead ofconfig.data
forundefined
).The text was updated successfully, but these errors were encountered: