From c315925a7e9c158606bb1305e290b8c5547b1980 Mon Sep 17 00:00:00 2001 From: Weidong Xu Date: Fri, 13 Dec 2024 07:01:08 +0800 Subject: [PATCH] http-client-java, remove code of convert contentType to header param (#5351) for https://github.com/Azure/azure-sdk-for-java/pull/43318/files#r1878889294 test PR https://github.com/Azure/autorest.java/pull/2996, it passes --- .../core/preprocessor/tranformer/Transformer.java | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/preprocessor/tranformer/Transformer.java b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/preprocessor/tranformer/Transformer.java index 90e5af1b9c..f6777723a8 100644 --- a/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/preprocessor/tranformer/Transformer.java +++ b/packages/http-client-java/generator/http-client-generator-core/src/main/java/com/microsoft/typespec/http/client/generator/core/preprocessor/tranformer/Transformer.java @@ -39,7 +39,6 @@ import java.util.ListIterator; import java.util.Map; import java.util.Objects; -import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -206,19 +205,6 @@ private void transformOperationGroups(List operationGroups, Code } } } - // convert contentType to header param - Optional contentType = request.getParameters() - .stream() - .filter(p -> (p.getProtocol() == null || p.getProtocol().getHttp() == null) - && "contentType".equals(p.getLanguage().getDefault().getName())) - .findFirst(); - if (contentType.isPresent()) { - Protocols protocols = new Protocols(); - protocols.setHttp(new Protocol()); - protocols.getHttp().setIn(RequestParameterLocation.HEADER); - contentType.get().setProtocol(protocols); - contentType.get().getLanguage().getDefault().setSerializedName("Content-Type"); - } } renameOdataParameterNames(request); deduplicateParameterNames(request);