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

POST operations are sent as GET requests #246

Closed
billdami opened this issue Jun 28, 2013 · 5 comments
Closed

POST operations are sent as GET requests #246

billdami opened this issue Jun 28, 2013 · 5 comments

Comments

@billdami
Copy link

I have several operations defined in my api's with an httpMethod of POST, and in my index.html the supportedSubmitMethods array does contain 'post', however when I attempt to test these endpoints, they are sent via a GET ajax request, not a POST.

Is there any other requirements to get them to be submitted as a POST request? For instance these operations do include some "query" type parameters, as I want them in the query string, not the post data - but that shouldn't prevent it from being a POST request should it?

@fehguy
Copy link
Contributor

fehguy commented Jul 7, 2013

Hi, there is a major refactor of swagger-ui that's getting into RC phase which moves the submit operations into a UI-free swagger.js library.

Could please give the 2.0-develop branch a shot? The underlying javascript library is now well tested, and should be working correctly.

Please reopen if you see issues still.

@fehguy fehguy closed this as completed Jul 7, 2013
@billdami
Copy link
Author

billdami commented Jul 8, 2013

@fehguy Thanks for the response on this. Do you have any new documentation/readme in the works for 2.0? I tried to get it working however it seems the configuration of the SwaggerUI instance has changed considerably. For instance, the value that I provide for the api_key does not seem to be included in the query, and it looks like apiKeyName is no longer a valid option?

@fehguy
Copy link
Contributor

fehguy commented Jul 8, 2013

Yea, I'm working on docs now. For the key, it's actually very simple now, look at this part of the index.html:

https://github.com/wordnik/swagger-ui/blob/develop-2.0/dist/index.html#L44

    $('#input_apiKey').change(function() {
      var key = $('#input_apiKey')[0].value;
      console.log("key: " + key);
      if(key && key.trim() != "") {
        window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
      }
    })
    window.swaggerUi.load();
  });

@billdami
Copy link
Author

@fehguy Thanks for all your assistance with this. The 2.0 branch is looking really good so far, however it looks like the errorResponses data is no longer displayed in the UI. I'm assuming you just haven't gotten to implementing that yet, but just wanted to make you aware in case it is in fact a bug.

@fehguy
Copy link
Contributor

fehguy commented Jul 10, 2013

Thanks, yes, this is a bug. The errorResponses have been renamed responseMessages because they're not always errors, and can contain different response classes. I'll make sure that transparently gets supported in the UI, I thought it already was.

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