Peekab0o
@Peekab0o
Node.js developer

Почему в swagger не приходит ответ с «Try this operation»?

C помощью editor.swagger.io сделал разметку GET запроса.
исходник:
swagger: "2.0"
info:
  version: 1.0.0
  title: Documents API
  description: A sample API that demonstrates Box.com works
host: view-api.box.com
basePath: /1
consumes:
  - application/json
produces:
  - application/text
securityDefinitions:
  apikey:
    type: apiKey
    name: Authorization
    in: header
schemes:
  - https
paths:
  /documents:
    get:
      operationId: getDocuments
      tags:
        - users
      summary: ""
      description: |
        Gets a list of documents.
      security: 
        - apikey: []
      responses:
        200:
          description: Returns an array of MiniUser
        401:
          description: You are not authenticated
        403:
          description: Your user doesn't have suficient permissions
        429:
          description: Too many requests
        default:
          description: An unexpected error
          schema:
            $ref: '#/definitions/documents_collection'
definitions:
  documents_collection:
    description: List of a documents.
    type: object

Когда жму "Try this operation" - показывает такой запрос:
GET https://view-api.box.com/1/documents HTTP/1.1
Host: view-api.box.com
Accept: application/text
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
Origin: http://editor.swagger.io
Referer: http://editor.swagger.io/
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.106 Safari/537.36
Authorization: Token ytoje08mar23k291tay3sndjl6hfz7uu

И наконец, когда жму "Send request" мне приходит error:
Headers
undefined
Body

Кто знает - что не так...?

Доки по view-api.box.com - https://box-view.readme.io/reference#documents-1
  • Вопрос задан
  • 229 просмотров
Решения вопроса 1
Peekab0o
@Peekab0o Автор вопроса
Node.js developer
Проблема все таки в отсутствии CORS на сервере box.com. Проблема решится либо если скачать с github исходники swagger editor и переписать метод отправки запросов, либо каким-то другим хаком запроса...
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы