2

这就是我在 api.description.yml 中传递的内容

  parameters:
    - name: "file"
      in: "formData"
      required: true
      type: file
      description: fileupload
  consumes:
    - multipart/form-data;

不确定在哪里/如何在挂钩或 yml 文件中发送文件数据?

4

1 回答 1

0

请参阅Dredd 文档中的发送多部分请求部分:

swagger: '2.0'
info:
title: "Testing 'multipart/form-data' Request API"
version: '1.0'
consumes:
- multipart/form-data; boundary=CUSTOM-BOUNDARY
produces:
- application/json; charset=utf-8
paths:
'/data':
    post:
    parameters:
        - name: text
        in: formData
        type: string
        required: true
        x-example: "test equals to 42"
        - name: json
        in: formData
        type: string
        required: true
        x-example: '{"test": 42}'
    responses:
        200:
        description: 'Test OK'
        examples:
            application/json; charset=utf-8:
            test: 'OK'
于 2019-03-25T13:21:15.190 回答