I use post method,why it becomes option method?
my yml file:
post:
summary: input vip.
description: |
Input a new vip to Libra.
parameters:
- name: vip
in: body
description: user to add to the system
required: true
schema:
$ref: '#/definitions/vip_body'
and the definition of vip_body: vip_body: properties: vip: type: string description: vip real ip.
when i click the Send Request button to post data,the screen text show me these info: POST http://xxx.xxx.xxx.com HTTP/1.1 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 Content-Length: 28 Content-Type: application/json Host: xxx.xxx.xxx.xxxx Origin: http://xxx.xxx.xxx.xxx Referer: http://xxx.xxx.xxx.xxx/ User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36 { "vip": "10.201.51.190" }
but the server logs are: [W 150416 18:58:32 web:1812] 405 OPTIONS /vips (127.0.0.1) 1.48ms [W 150416 18:59:13 web:1812] 405 OPTIONS /vips (127.0.0.1) 0.58ms [W 150416 19:02:14 web:1812] 405 OPTIONS /vips (127.0.0.1) 0.53ms
It's a CORS issue - https://github.com/swagger-api/swagger-editor/blob/master/docs/cors.rst.
@webron is correct. It's a CORS issue. Swagger Editor uses a third party server to get around servers that don't have CORS enabled for importing swagger. But for making calls, you need to either enable CORS in your server or host the editor in your own domain.