node.js - Swagger Editor - declare request json body fields as formData, but send these as json -


i'm using latest swagger editor, , server api accepted json body requests, if declare parameter formdata docs developer. question: how can declare parameter formdata when try send json body request. tried swagger editor oldest version 2.9.6 , declare parameter formdata , declare "produces" , "consumes" "application/json" if try on editor works, if generate nodejs-server , try send content-type form-url-encoding, following screenshots:

enter image description here enter image description here

if generate nodejs-server, not works:

enter image description here

how can declare parameter formdata when try send json body request.

you can't. api specification contract between client , server , supposed precisely define server behavior. if server expects json, specification must use in: body parameters , not in: formdata. if server works in 1 way , spec states way, it's useless.

if want use formdata parameters in spec, change server accept form data , write spec accordingly.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -