Description
I do not have permission to reopen 1010 hence new issue. Sorry for duplication. With the latest fix it seems the consumes is being used to fill up Content-Type, However if the spec does not have consumes it still remains the same. In 2.x it was getting defaulted to application/json. The body serialisations issue also still exists.
This issue is in further reference to #991
With version 3.0.5 a swagger client instance tries to make an API request the following issues are observed
- Content-Type header is not added in the request.
- If a parameter used in HTTP body is added to the request the client expects it to be in the string format.
However while using 2.0.32 there is no need to set these explicitly. So is there a way we can get back the old behaviour with latest version, like adding "application/json" as default content type and the adding body parameter as JSON object rather than string.
Code example:
var Swagger = require('swagger-client');
new Swagger({
"url":"https://staging.cloud-elements.com/elements/api-v2/elements/44/docs"
})
.then(function (client) {
client.apis.zohocrm.createAccount({"Authorization":"...","body":{"Account Name":"XYZ1"}})
.then(function(response){
console.log(response);
})
.catch(function (error) {
console.log(error);
});
}).catch(function (error) {
console.log(error);
});