@@ -953,8 +953,8 @@ private void writeRequestHeaders(
953953 ) {
954954 TypeScriptWriter writer = context .getWriter ();
955955
956- List <HttpBinding > headers = bindingIndex .getRequestBindings (operation , Location .HEADER );
957956 List <HttpBinding > prefixHeaders = bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
957+ List <HttpBinding > headers = bindingIndex .getRequestBindings (operation , Location .HEADER );
958958 boolean inputPresent = operation .getInput ().isPresent ();
959959
960960 int normalHeaderCount = headers .size ();
@@ -981,19 +981,19 @@ private void writeRequestHeaders(
981981 writeDefaultInputHeaders (context , operation );
982982
983983 if (inputPresent ) {
984- for (HttpBinding binding : headers ) {
985- writeNormalHeader (context , binding );
984+ // Handle assembling prefix headers.
985+ for (HttpBinding binding : prefixHeaders ) {
986+ writePrefixHeaders (context , binding );
986987 }
987988 }
988989
989- flushHeadersBuffer (writer );
990-
991990 if (inputPresent ) {
992- // Handle assembling prefix headers.
993- for (HttpBinding binding : prefixHeaders ) {
994- writePrefixHeaders (context , binding );
991+ for (HttpBinding binding : headers ) {
992+ writeNormalHeader (context , binding );
995993 }
996994 }
995+
996+ flushHeadersBuffer (writer );
997997 writer .dedent ();
998998 writer .write (closing );
999999 }
@@ -1081,13 +1081,13 @@ private void writePrefixHeaders(GenerationContext context, HttpBinding binding)
10811081 String headerValue = getInputValue (context , binding .getLocation (),
10821082 memberLocation + "![suffix]" , binding .getMember (), target );
10831083 // Append the prefix to key.
1084- writer .write ("acc[`$L$${suffix.toLowerCase()}`] = $L ;" ,
1084+ writer .write ("acc = { ...{ [`$L$${suffix.toLowerCase()}`]: $L}, ...acc } ;" ,
10851085 binding .getLocationName ().toLowerCase (Locale .US ), headerValue );
10861086 writer .write ("return acc;" );
10871087 });
1088- }
1089- );
1090- }
1088+ }
1089+ );
1090+ }
10911091
10921092 private void writeResponseHeaders (
10931093 GenerationContext context ,
@@ -1103,16 +1103,16 @@ private void writeResponseHeaders(
11031103 writeContentTypeHeader (context , operationOrError , false );
11041104 injectExtraHeaders .run ();
11051105
1106+ for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS )) {
1107+ writePrefixHeaders (context , binding );
1108+ }
1109+
1110+ // Handle assembling prefix headers.
11061111 for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .HEADER )) {
11071112 writeNormalHeader (context , binding );
11081113 }
11091114
11101115 flushHeadersBuffer (writer );
1111-
1112- // Handle assembling prefix headers.
1113- for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS )) {
1114- writePrefixHeaders (context , binding );
1115- }
11161116 });
11171117 }
11181118
@@ -2251,12 +2251,12 @@ private void readResponseHeaders(
22512251 HttpBindingIndex bindingIndex ,
22522252 String outputName
22532253 ) {
2254- List <HttpBinding > headerBindings = bindingIndex .getResponseBindings (operationOrError , Location .HEADER );
2255- readNormalHeaders (context , headerBindings , outputName );
2256-
22572254 List <HttpBinding > prefixHeaderBindings =
22582255 bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS );
22592256 readPrefixHeaders (context , prefixHeaderBindings , outputName );
2257+
2258+ List <HttpBinding > headerBindings = bindingIndex .getResponseBindings (operationOrError , Location .HEADER );
2259+ readNormalHeaders (context , headerBindings , outputName );
22602260 }
22612261
22622262 private void readRequestHeaders (
@@ -2265,12 +2265,12 @@ private void readRequestHeaders(
22652265 HttpBindingIndex bindingIndex ,
22662266 String outputName
22672267 ) {
2268- List <HttpBinding > headerBindings = bindingIndex .getRequestBindings (operation , Location .HEADER );
2269- readNormalHeaders (context , headerBindings , outputName );
2270-
22712268 List <HttpBinding > prefixHeaderBindings =
22722269 bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
22732270 readPrefixHeaders (context , prefixHeaderBindings , outputName );
2271+
2272+ List <HttpBinding > headerBindings = bindingIndex .getRequestBindings (operation , Location .HEADER );
2273+ readNormalHeaders (context , headerBindings , outputName );
22742274 }
22752275
22762276 /**
@@ -2992,3 +2992,24 @@ protected boolean enableSerdeElision() {
29922992 return false ;
29932993 }
29942994}
2995+ ads .
2996+ */
2997+ protected abstract boolean requiresNumericEpochSecondsInPayload ();
2998+
2999+ /**
3000+ * Implement a return true if the protocol allows elision of serde functions.
3001+ *
3002+ * @return whether protocol implementation is compatible with serde elision.
3003+ */
3004+ protected boolean enableSerdeElision () {
3005+ return false ;
3006+ }
3007+ }
3008+ e if the protocol allows elision of serde functions .
3009+ *
3010+ * @ return whether protocol implementation is compatible with serde elision .
3011+ */
3012+ protected boolean enableSerdeElision () {
3013+ return false ;
3014+ }
3015+ }
0 commit comments