diff --git a/lib/serviceClient.ts b/lib/serviceClient.ts index 83e5e4a..6b039ed 100644 --- a/lib/serviceClient.ts +++ b/lib/serviceClient.ts @@ -221,6 +221,10 @@ export class ServiceClient { } httpRequest.url = requestUrl.toString(); + if (operationSpec.contentType) { + httpRequest.headers.set("Content-Type", operationSpec.contentType); + } + if (operationSpec.headerParameters) { for (const headerParameter of operationSpec.headerParameters) { let headerValue: any = getOperationArgumentValueFromParameter(operationArguments, headerParameter, operationSpec.serializer); @@ -238,10 +242,6 @@ export class ServiceClient { } } - if (operationSpec.contentType) { - httpRequest.headers.set("Content-Type", operationSpec.contentType); - } - if (operationArguments.customHeaders) { for (const customHeaderName in operationArguments.customHeaders) { httpRequest.headers.set(customHeaderName, operationArguments.customHeaders[customHeaderName]);