Content-Type = multipart/form-data
#上传文件


Rquest Payload

    ------WebKitFormBoundarymAyGmnyhpf3UBdec
    Content-Disposition: form-data; name="sysCode"


    S04
    ------WebKitFormBoundarymAyGmnyhpf3UBdec
    Content-Disposition: form-data; name="subSysCode"


    S0401
    ------WebKitFormBoundarymAyGmnyhpf3UBdec
    Content-Disposition: form-data; name="fileType"


    image
    ------WebKitFormBoundarymAyGmnyhpf3UBdec
    Content-Disposition: form-data; name="filePermission"


    PUBLIC
    ------WebKitFormBoundarymAyGmnyhpf3UBdec
    Content-Disposition: form-data; name="file"; filename="2.jpg"
    Content-Type: image/jpeg

    ------WebKitFormBoundarymAyGmnyhpf3UBdec--



#
yaml用例 - test: name: 上传文件 request: url: $url/api/add method: POST files: sysCode: [null,'S04'] subSysCode: [null,'S0401'] fileType: [null,'image' ] filePermission: [null,'PUBLIC'] file: ['2.jpg',$file1,'image/jpeg'] extract: - fileId: content.responseBody.fileId validate: - eq: [status_code, 200] - eq: [content.status, SUCCESS] - eq: [content.status, SUCCESS] variables: - filePath: "D:\\Pictures\\2.jpg" - file1: ${get_file($filePath)}

file参数说明:
file = {'name': (<filename>, <file object>,<content type>, <per-part headers>)}

 

#debugtalk.py
# 读取文件内容
def get_file(filePath):
    return open(filePath, "rb")

相关文章:

  • 2022-12-23
  • 2021-11-27
  • 2021-07-24
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-10-28
  • 2021-08-19
  • 2022-02-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案