From 9c580a24478f17bb63f8692a12c79d2042df001b Mon Sep 17 00:00:00 2001 From: xhh Date: Wed, 20 Jan 2016 10:29:09 +0800 Subject: [PATCH] Set accept header for JavaScript client --- .../src/main/resources/Javascript/ApiClient.mustache | 5 +++++ samples/client/petstore/javascript/src/ApiClient.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache index 2f85250694..84d07d6933 100644 --- a/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/swagger-codegen/src/main/resources/Javascript/ApiClient.mustache @@ -130,6 +130,11 @@ request.send(bodyParam); } + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); + } + request.end(function(error, response) { if (callback) { var data = response && response.body; diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 8138225e2b..3476b7dbba 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -130,6 +130,11 @@ request.send(bodyParam); } + var accept = this.jsonPreferredMime(accepts); + if (accept) { + request.accept(accept); + } + request.end(function(error, response) { if (callback) { var data = response && response.body;