“ERROR Server not found or an error occurred” whil

2019-08-20 10:28发布

问题:

I'm creating a simple get/post api, when I use post Method I get "ERROR Server not found or an error occurred", even when I run it from POSTMAN or from chrome (Where I have installed CORS Toggle extension)

my server is running on: http://localhost:10010

My Spec :

swagger: "2.0"
info:
  version: "0.0.1"
  title: Todo API
# during dev, should point to your local machine
host: localhost:10010
# basePath prefixes all resource paths 
basePath: /
# 
schemes:
  # tip: remove http to make production-grade
  - http
  - https
# format of bodies a client can send (Content-Type)
consumes:
  - application/json
# format of the responses to the client (Accepts)
produces:
  - application/json
paths:
  /todo:
    get:
      description: "this endpoint returns list of todo events"
      operationId: "GetAtodo"
      parameters:  
      - name: "todo_id"
        in: "query"
        description: "ID of todo to return"
        required: true
        type: "integer"
        format: "int64"
      responses:
        200:
          description: "an array of all the present todos"
          schema:
            items:
              $ref: "#/definitions/Todo"
    post:
      description: "add a new todo event"
      operationId: "AddTodo"
      produces:
        - "application/json"
      parameters: 
      - in: "body"
        name: "todo"
        description: "todo to be added"
        required: true
        schema:
              $ref: "#/definitions/Todo"
      responses:
        200:
          description: "successful todo addition"
        405:
          description: "Invalid input"
        404:
          description: "Todo server not found"
  /swagger:
    x-swagger-pipe: swagger_raw
# complex objects have schema definitions
definitions:
 Todo:
  type: "object"
  properties: 
    todo_id:
      type: "integer"
      description: "id of the todo event"
    todo:
      type: "string"
      description: "The todo item"

Snapshot:

UPDATE 1: