swagger-ui icon indicating copy to clipboard operation
swagger-ui copied to clipboard

"Post" and "Put" not working for me

Open mkrouwer opened this issue 12 years ago • 11 comments

Whenever I try to "Post" I get "Content cannot be null" as an error, even though content is not null and there is valid input in the body param. Whenever I try to "Put" I get back "Object reference not set to an instance of an object." I'm thinking this might be since swagger does not have a clear object type in it's spec? Any advice or help you guys could give me would be much appreciated! Thanks

mkrouwer avatar Sep 26 '14 23:09 mkrouwer

Can you give us more information? Possibly share your swagger specification file?

webron avatar Sep 27 '14 15:09 webron

Hi! My Swagger spec is bellow. All the input for these verbs have been tested and are working fine with the Swagger 1.2 spec, I converted all the json into the 2.0 spec and while get and delete are working fine, put and post still have issues, they're not transmitting correct requests and so I'm getting the errors I wrote above as responses. Thank you so much!

mkrouwer avatar Sep 29 '14 00:09 mkrouwer

Hi, I tested this and see the OPTIONS request being sent correctly. Is the server public and accessible externally?

fehguy avatar Sep 29 '14 02:09 fehguy

no it's private, did you test post and put and they were working fine on the swagger end?

mkrouwer avatar Sep 29 '14 02:09 mkrouwer

Give it a whirl again. I think it's fixed in https://github.com/wordnik/swagger-ui/commit/b0eff2d78b7882026b0220abbbcd178598200a9b

fehguy avatar Sep 29 '14 03:09 fehguy

Just pulled and now it's fixed! Thanks a bunch :D

mkrouwer avatar Sep 29 '14 17:09 mkrouwer

Great, thank you

fehguy avatar Sep 29 '14 17:09 fehguy

sorry! My mistake, I actually tested 1.2 Swagger instead of Swagger 2.0 by accident. This recent pull broke all of my verbs.

mkrouwer avatar Sep 29 '14 20:09 mkrouwer

I'm confused. So it's not working?

fehguy avatar Sep 29 '14 20:09 fehguy

Sorry! Let me make sure I tested the right version and I didn't do something weird on my end

mkrouwer avatar Sep 29 '14 21:09 mkrouwer

nvm it is working! Sorry about that

mkrouwer avatar Sep 29 '14 23:09 mkrouwer