File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 66 */
77
88/* globals Request: false */
9+ /* globals Headers: false */
910
1011'use strict' ;
1112
@@ -863,6 +864,7 @@ p5.prototype.httpDo = function () {
863864 var request ;
864865 var jsonpOptions = { } ;
865866 var cbCount = 0 ;
867+ var contentType = 'text/plain' ;
866868 // Trim the callbacks off the end to get an idea of how many arguments are passed
867869 for ( var i = arguments . length - 1 ; i > 0 ; i -- ) {
868870 if ( typeof arguments [ i ] === 'function' ) {
@@ -914,6 +916,7 @@ p5.prototype.httpDo = function () {
914916 }
915917 } else {
916918 data = JSON . stringify ( a ) ;
919+ contentType = 'application/json' ;
917920 }
918921 } else if ( typeof a === 'function' ) {
919922 if ( ! callback ) {
@@ -937,7 +940,10 @@ p5.prototype.httpDo = function () {
937940 request = new Request ( path , {
938941 method : method ,
939942 mode : 'cors' ,
940- body : data
943+ body : data ,
944+ headers : new Headers ( {
945+ 'Content-Type' : contentType
946+ } )
941947 } ) ;
942948 }
943949
You can’t perform that action at this time.
0 commit comments