Skip to content
New issue

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

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

Already on GitHub? # to your account

POST formData not working #838

Closed
clickslide opened this issue Jan 20, 2015 · 10 comments
Closed

POST formData not working #838

clickslide opened this issue Jan 20, 2015 · 10 comments
Milestone

Comments

@clickslide
Copy link

I'm trying to send a simple string as a POST parameter in swagger 2.0. However, I cannot seem to get it to work.

    post:
      summary: POST simple parameter
      description: Test
      consumes:
        - application/x-www-form-urlencoded
      parameters:
         -  name: _method
            in: formData
            type: string
            required: true
            description: testing

When I view a log of the $_POST details in my PHP server, the array is empty. It should contain the "_method" parameter.

Please note that this was found as a bug in the swagger-editor here: swagger-api/swagger-editor#299

I have found the same problem in the swagger-ui. Perhaps I'm missing something?

@webron
Copy link
Contributor

webron commented Jan 20, 2015

Confirmed. Looks like a regression.

@webron webron added this to the v2.1.0-M1 milestone Jan 20, 2015
@harikt
Copy link

harikt commented Jan 23, 2015

Subscribing for I have also been testing the same.

@mattoshry
Copy link

Ran into this as well and wondered if the problem is here:
https://github.com/swagger-api/swagger-ui/blob/master/lib/swagger-client.js#L852
Perhaps the loop on 858 should populate formParams if param.in === 'formData'?

  if (param.in === 'body') {
    body = args[param.name];
  } else if (param.in === 'formData') {
    formParams[param.name] = args[param.name];
  }

@webron
Copy link
Contributor

webron commented Jan 24, 2015

@mattoshry - doesn't seem like it, considering the section following it - https://github.com/swagger-api/swagger-ui/blob/master/lib/swagger-client.js#L864-L877.

@webron
Copy link
Contributor

webron commented Jan 24, 2015

Ah, now I see what you mean. Looking back, the method was split into two, so the formParams indeed doesn't get populated.

@retrospectacus
Copy link

This patch f9af6110334681cf570b2c03127d46bb4b6f6984 fixed my issue. Now swagger-ui correctly sends formData parameters with POST request in "Try it out" function.

@fehguy fehguy modified the milestone: v2.1.0-M1 Jan 28, 2015
@fehguy
Copy link
Contributor

fehguy commented Jan 30, 2015

this was fixed in develop_2.0

@tsamples
Copy link

Is this now in the current version Version 2.10.1, I still seem to be experiencing this issue as is stated.

@webron
Copy link
Contributor

webron commented Jun 16, 2016

@tsamples - you may be confusing this project with swagger-editor.

@tsamples
Copy link

Thanks, You are correct it is a documented issue on the swagger editor
project.

swagger-api/swagger-editor#599

On Wed, Jun 15, 2016 at 9:05 PM, Ron notifications@github.com wrote:

@tsamples https://github.com/tsamples - you may be confusing this
project with swagger-editor.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#838 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ABXFPyReSrjOB9VUjugutBuqfypWTJdjks5qMK9tgaJpZM4DU4rt
.

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

No branches or pull requests

7 participants