@@ -953,8 +953,8 @@ private void writeRequestHeaders(
953
953
) {
954
954
TypeScriptWriter writer = context .getWriter ();
955
955
956
- List <HttpBinding > prefixHeaders = bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
957
956
List <HttpBinding > headers = bindingIndex .getRequestBindings (operation , Location .HEADER );
957
+ List <HttpBinding > prefixHeaders = bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
958
958
boolean inputPresent = operation .getInput ().isPresent ();
959
959
960
960
int normalHeaderCount = headers .size ();
@@ -980,20 +980,20 @@ private void writeRequestHeaders(
980
980
writeContentTypeHeader (context , operation , true );
981
981
writeDefaultInputHeaders (context , operation );
982
982
983
- if (inputPresent ) {
984
- // Handle assembling prefix headers.
985
- for (HttpBinding binding : prefixHeaders ) {
986
- writePrefixHeaders (context , binding );
987
- }
988
- }
989
-
990
983
if (inputPresent ) {
991
984
for (HttpBinding binding : headers ) {
992
985
writeNormalHeader (context , binding );
993
986
}
994
987
}
995
988
996
989
flushHeadersBuffer (writer );
990
+
991
+ if (inputPresent ) {
992
+ // Handle assembling prefix headers.
993
+ for (HttpBinding binding : prefixHeaders ) {
994
+ writePrefixHeaders (context , binding );
995
+ }
996
+ }
997
997
writer .dedent ();
998
998
writer .write (closing );
999
999
}
@@ -1081,13 +1081,13 @@ private void writePrefixHeaders(GenerationContext context, HttpBinding binding)
1081
1081
String headerValue = getInputValue (context , binding .getLocation (),
1082
1082
memberLocation + "![suffix]" , binding .getMember (), target );
1083
1083
// Append the prefix to key.
1084
- writer .write ("acc = { ...{ [`$L$${suffix.toLowerCase()}`]: $L}, ...acc } ;" ,
1084
+ writer .write ("acc[`$L$${suffix.toLowerCase()}`] = $L ;" ,
1085
1085
binding .getLocationName ().toLowerCase (Locale .US ), headerValue );
1086
1086
writer .write ("return acc;" );
1087
1087
});
1088
- }
1089
- );
1090
- }
1088
+ }
1089
+ );
1090
+ }
1091
1091
1092
1092
private void writeResponseHeaders (
1093
1093
GenerationContext context ,
@@ -1103,16 +1103,16 @@ private void writeResponseHeaders(
1103
1103
writeContentTypeHeader (context , operationOrError , false );
1104
1104
injectExtraHeaders .run ();
1105
1105
1106
- for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS )) {
1107
- writePrefixHeaders (context , binding );
1108
- }
1109
-
1110
- // Handle assembling prefix headers.
1111
1106
for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .HEADER )) {
1112
1107
writeNormalHeader (context , binding );
1113
1108
}
1114
1109
1115
1110
flushHeadersBuffer (writer );
1111
+
1112
+ // Handle assembling prefix headers.
1113
+ for (HttpBinding binding : bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS )) {
1114
+ writePrefixHeaders (context , binding );
1115
+ }
1116
1116
});
1117
1117
}
1118
1118
@@ -2251,12 +2251,12 @@ private void readResponseHeaders(
2251
2251
HttpBindingIndex bindingIndex ,
2252
2252
String outputName
2253
2253
) {
2254
+ List <HttpBinding > headerBindings = bindingIndex .getResponseBindings (operationOrError , Location .HEADER );
2255
+ readNormalHeaders (context , headerBindings , outputName );
2256
+
2254
2257
List <HttpBinding > prefixHeaderBindings =
2255
2258
bindingIndex .getResponseBindings (operationOrError , Location .PREFIX_HEADERS );
2256
2259
readPrefixHeaders (context , prefixHeaderBindings , outputName );
2257
-
2258
- List <HttpBinding > headerBindings = bindingIndex .getResponseBindings (operationOrError , Location .HEADER );
2259
- readNormalHeaders (context , headerBindings , outputName );
2260
2260
}
2261
2261
2262
2262
private void readRequestHeaders (
@@ -2265,12 +2265,12 @@ private void readRequestHeaders(
2265
2265
HttpBindingIndex bindingIndex ,
2266
2266
String outputName
2267
2267
) {
2268
+ List <HttpBinding > headerBindings = bindingIndex .getRequestBindings (operation , Location .HEADER );
2269
+ readNormalHeaders (context , headerBindings , outputName );
2270
+
2268
2271
List <HttpBinding > prefixHeaderBindings =
2269
2272
bindingIndex .getRequestBindings (operation , Location .PREFIX_HEADERS );
2270
2273
readPrefixHeaders (context , prefixHeaderBindings , outputName );
2271
-
2272
- List <HttpBinding > headerBindings = bindingIndex .getRequestBindings (operation , Location .HEADER );
2273
- readNormalHeaders (context , headerBindings , outputName );
2274
2274
}
2275
2275
2276
2276
/**
@@ -2992,24 +2992,3 @@ protected boolean enableSerdeElision() {
2992
2992
return false ;
2993
2993
}
2994
2994
}
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