@@ -97,7 +97,7 @@ export class ProgressEvent<R extends BaseModel = BaseModel, T = Map<string, any>
9797 return null ;
9898 }
9999
100- public serialize ( toTesponse = false , bearerToken ?: string ) : Map < string , any > {
100+ public serialize ( ) : Map < string , any > {
101101 // To match Java serialization, which drops 'null' values, and the
102102 // contract tests currently expect this also.
103103 const json : Map < string , any > = new Map < string , any > ( Object . entries ( this ) ) ; //JSON.parse(JSON.stringify(this)));
@@ -107,26 +107,17 @@ export class ProgressEvent<R extends BaseModel = BaseModel, T = Map<string, any>
107107 }
108108 } ) ;
109109 // Mutate to what's expected in the response.
110- if ( toTesponse ) {
111- json . set ( 'bearerToken' , bearerToken ) ;
112- json . set ( 'operationStatus' , json . get ( 'status' ) ) ;
113- json . delete ( 'status' ) ;
114- if ( this . resourceModel ) {
115- json . set ( 'resourceModel' , this . resourceModel . toObject ( ) ) ;
116- }
117- if ( this . resourceModels ) {
118- const models = this . resourceModels . map ( ( resource : R ) =>
119- resource . toObject ( )
120- ) ;
121- json . set ( 'resourceModels' , models ) ;
122- }
123- json . delete ( 'callbackDelaySeconds' ) ;
124- if ( json . has ( 'callbackContext' ) ) {
125- json . delete ( 'callbackContext' ) ;
126- }
127- if ( this . errorCode ) {
128- json . set ( 'errorCode' , this . errorCode ) ;
129- }
110+ if ( this . resourceModel ) {
111+ json . set ( 'resourceModel' , this . resourceModel . toObject ( ) ) ;
112+ }
113+ if ( this . resourceModels ) {
114+ const models = this . resourceModels . map ( ( resource : R ) =>
115+ resource . toObject ( )
116+ ) ;
117+ json . set ( 'resourceModels' , models ) ;
118+ }
119+ if ( this . errorCode ) {
120+ json . set ( 'errorCode' , this . errorCode ) ;
130121 }
131122 return json ;
132123 }
0 commit comments