This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Expand file tree Collapse file tree 4 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 6464 "isWindow" : false ,
6565 "isScope" : false ,
6666 "isFile" : false ,
67+ "isBlob" : false ,
6768 "isBoolean" : false ,
6869 "trim" : false ,
6970 "isElement" : false ,
Original file line number Diff line number Diff line change 4545 -isWindow,
4646 -isScope,
4747 -isFile,
48+ -isBlob,
4849 -isBoolean,
4950 -trim,
5051 -isElement,
@@ -566,6 +567,11 @@ function isFile(obj) {
566567}
567568
568569
570+ function isBlob ( obj ) {
571+ return toString . call ( obj ) === '[object Blob]' ;
572+ }
573+
574+
569575function isBoolean ( value ) {
570576 return typeof value === 'boolean' ;
571577}
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ function $HttpProvider() {
103103
104104 // transform outgoing request data
105105 transformRequest : [ function ( d ) {
106- return isObject ( d ) && ! isFile ( d ) ? toJson ( d ) : d ;
106+ return isObject ( d ) && ! isFile ( d ) && ! isBlob ( d ) ? toJson ( d ) : d ;
107107 } ] ,
108108
109109 // default headers
Original file line number Diff line number Diff line change @@ -989,6 +989,16 @@ describe('$http', function() {
989989 } ) ;
990990
991991
992+ it ( 'should ignore Blob objects' , function ( ) {
993+ if ( ! window . Blob ) return ;
994+
995+ var blob = new Blob ( [ 'blob!' ] , { type : 'text/plain' } ) ;
996+
997+ $httpBackend . expect ( 'POST' , '/url' , '[object Blob]' ) . respond ( '' ) ;
998+ $http ( { method : 'POST' , url : '/url' , data : blob } ) ;
999+ } ) ;
1000+
1001+
9921002 it ( 'should have access to request headers' , function ( ) {
9931003 $httpBackend . expect ( 'POST' , '/url' , 'header1' ) . respond ( 200 ) ;
9941004 $http . post ( '/url' , 'req' , {
You can’t perform that action at this time.
0 commit comments