From 708885e197041453f61ef99837a82e369c73aaf8 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Mon, 25 Jun 2018 15:11:25 -0700 Subject: [PATCH] Allow operation headers and custom headers to override contentType --- lib/serviceClient.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/serviceClient.ts b/lib/serviceClient.ts index 54d1372..1535bf6 100644 --- a/lib/serviceClient.ts +++ b/lib/serviceClient.ts @@ -218,6 +218,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); @@ -235,10 +239,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]);