@@ -953,8 +953,8 @@ private void writeRequestHeaders(
953953 ) {
954954 TypeScriptWriter writer = context .getWriter ();
955955
956- List <HttpBinding > prefixHeaders = bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
957956 List <HttpBinding > headers = bindingIndex .getRequestBindings (operation , Location .HEADER );
957+ List <HttpBinding > prefixHeaders = bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
958958 boolean inputPresent = operation .getInput ().isPresent ();
959959
960960 int normalHeaderCount = headers .size ();
@@ -980,20 +980,20 @@ private void writeRequestHeaders(
980980 writeContentTypeHeader (context , operation , true );
981981 writeDefaultInputHeaders (context , operation );
982982
983- if (inputPresent ) {
984- // Handle assembling prefix headers.
985- for (HttpBinding binding : prefixHeaders ) {
986- writePrefixHeaders (context , binding );
987- }
988- }
989-
990983 if (inputPresent ) {
991984 for (HttpBinding binding : headers ) {
992985 writeNormalHeader (context , binding );
993986 }
994987 }
995988
996989 flushHeadersBuffer (writer );
990+
991+ if (inputPresent ) {
992+ // Handle assembling prefix headers.
993+ for (HttpBinding binding : prefixHeaders ) {
994+ writePrefixHeaders (context , binding );
995+ }
996+ }
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}, ...acc } ;" ,
1084+ writer .write ("acc[`$L$${suffix.toLowerCase()}`] = $L ;" ,
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.
11111106 for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .HEADER )) {
11121107 writeNormalHeader (context , binding );
11131108 }
11141109
11151110 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+
22542257 List <HttpBinding > prefixHeaderBindings =
22552258 bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS );
22562259 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+
22682271 List <HttpBinding > prefixHeaderBindings =
22692272 bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
22702273 readPrefixHeaders (context , prefixHeaderBindings , outputName );
2271-
2272- List <HttpBinding > headerBindings = bindingIndex .getRequestBindings (operation , Location .HEADER );
2273- readNormalHeaders (context , headerBindings , outputName );
22742274 }
22752275
22762276 /**
@@ -2992,24 +2992,3 @@ 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