Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect method used for given operationId #991

Closed
srihakum opened this issue Mar 31, 2017 · 6 comments
Closed

Incorrect method used for given operationId #991

srihakum opened this issue Mar 31, 2017 · 6 comments

Comments

@srihakum
Copy link

I am trying to load a swagger and invoke a particular operationId (createAccount) which is a POST operation on the path /accounts. However when I run this code I get the result of GET on /accounts operation. Is there something I am doing wrong?
Test code:

var Swagger = require('swagger-client');
Swagger({"url":"https://staging.cloud-elements.com/elements/api-v2/elements/44/docs"}).then(function (client) {
    client.apis.zohocrm.createAccount({"Authorization":"","body":{"Account Name":"XYZ"}})
        .then(function(response){
            console.log(response);
        })
        .catch(function (error) {
            console.log(error);
        });
}).catch(function (error) {
    console.log(error);
});

I have not provided Authorization for security reasons. Hence the response would be 401.

@webron
Copy link
Contributor

webron commented Mar 31, 2017

Which version of swagger-js do you use?
Can you share the spec?

@srihakum
Copy link
Author

srihakum commented Apr 1, 2017

I am using 3.0.3 version. Spec is available here https://staging.cloud-elements.com/elements/api-v2/elements/44/docs. After deeper understanding it seems that there is no mention of schemes in the spec, so it looks to default to http. However the server was responding with 301 where the URL was retained as per location header and method was defaulted to GET. This redirection causes POST to be converted to GET.

@webron
Copy link
Contributor

webron commented Apr 3, 2017

Thanks for the analysis. We're aware of issues when schemes, host or basePath are missing and working to resolve those.

@srihakum
Copy link
Author

srihakum commented Apr 4, 2017

@webron Thanks for acknowledging the issue. Any timelines on when we can expect this to be available. We are currently blocked to use this in our code because of this issue. Any help here is much appreciated.

@webron
Copy link
Contributor

webron commented Apr 4, 2017

This is a very high priority for us, but I don't have an ETA for the fix.

@webron
Copy link
Contributor

webron commented Apr 8, 2017

This should be fixed in master/latest release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants