Swagger Editor is sending my POST as a GET

33 views
Skip to first unread message

Hank Zill

unread,
Aug 2, 2015, 2:48:08 PM8/2/15
to Swagger
I'm having trouble getting Swagger to send my request body as a raw JSON document using the "Try This Operation" feature. It keeps converting the JSON to a query string and sending the request as a GET, which my server rejects. I'm running locally, with the server on port 8080 and the editor on port 8081.

Here is my yaml:

paths:
  /signup:
    post:
      description:
        signup a user
      parameters:
        - in: body
          name: json
          description: The user signup details
          required: true
          schema:
            $ref: '#/definitions/UserSignup'
      responses:
        200:
          description: newly created user
          schema:
            properties:
              status:
                description: "status of the response"
                type: string
                enum: ['OK','Error']
              result:
                $ref: '#/definitions/UserBasic'

The UI is parsing it correctly, in that the UI displays the correct fields, and in the request preview it looks correct:

Host: localhost
Accept: application/json
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,fa;q=0.6,sv;q=0.4
Cache-Control: no-cache
Connection: keep-alive
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.134 Safari/537.36
Content-Length: 101
Content-Type: application/json
{
  "firstName": "Hank",
  "lastName": "Zill",
  "email": "ha...@example.com",
  "password": "hank1"
}

However, when I execute the command, it's sent as a GET. Here is the Chrome console output:

  1. Remote Address:
  2. Request URL:
  3. Request Method:
    GET
  4. Status Code:
    405 Method Not Allowed
I get the same error in Firefox. I assume there is something wrong with my definition, but I can't figure out what it is. I have tried setting the 'name' field in the parameters to 'body', but that doesn't help. I'm on Linux (Ubuntu 14.04), and using a version of the editor cloned from Github on August 1st.




Ron Ratovsky

unread,
Aug 3, 2015, 9:28:56 AM8/3/15
to Swagger
Can you open an issue directly on the swagger-editor repo?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Hank Zill

unread,
Aug 3, 2015, 11:12:16 AM8/3/15
to Swagger
Done.

You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/iAmdOAG1Zvs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages