@@ -440,7 +440,11 @@ const init = (AV) => {
440440 if ( ! AV . _isNullOrUndefined ( AV . applicationProduction ) ) {
441441 headers [ 'X-LC-Prod' ] = AV . applicationProduction ;
442442 }
443- headers [ 'User-Agent' ] = AV . _config . userAgent || `AV/${ AV . version } ; Node.js/${ process . version } ` ;
443+ if ( ! AVConfig . isNode ) {
444+ headers [ 'X-LC-UA' ] = `AV/${ AV . version } ` ;
445+ } else {
446+ headers [ 'User-Agent' ] = AV . _config . userAgent || `AV/${ AV . version } ; Node.js/${ process . version } ` ;
447+ }
444448
445449 return AV . Promise . as ( ) . then ( function ( ) {
446450 // Pass the session token
@@ -454,32 +458,6 @@ const init = (AV) => {
454458 } ) ;
455459 }
456460 } ) . then ( function ( ) {
457- // redirection for request with pre-flight is not supported by browser
458- // fallback to plain POST
459- if ( ! AVConfig . isNode ) {
460- try {
461- if ( _ . isObject ( dataObject ) ) {
462- if ( method . toLowerCase ( ) !== 'post' ) {
463- dataObject . _method = method ;
464- method = 'post' ;
465- }
466- dataObject . _ApplicationId = headers [ 'X-LC-Id' ] ;
467- // TODO: use X-LC-Sign
468- dataObject . _ApplicationKey = AV . applicationKey ;
469- if ( AV . _useMasterKey ) {
470- dataObject . _MasterKey = AV . masterKey ;
471- }
472- dataObject . _ApplicationProduction = headers [ 'X-LC-Prod' ] ;
473- dataObject . _ClientVersion = 'LC-Web-' + AV . version ;
474- dataObject . _SessionToken = headers [ 'X-LC-Session' ] ;
475- headers = {
476- 'content-type' : 'text/plain' ,
477- } ;
478- dataObject = JSON . stringify ( dataObject ) ;
479- }
480- } catch ( e ) { }
481- }
482-
483461 if ( method . toLowerCase ( ) === 'get' ) {
484462 if ( apiURL . indexOf ( '?' ) === - 1 ) {
485463 apiURL += '?' ;
0 commit comments