зеркало из https://github.com/Azure/ms-rest-js.git
Merge pull request #150 from RikkiGibson/OperationHeaderContentType
Allow operation headers and custom headers to override contentType
This commit is contained in:
Коммит
e4d9ebcb06
|
@ -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]);
|
||||
|
|
Загрузка…
Ссылка в новой задаче