编程技术

idea使用RestAPITester进行测试

2018-06-29  本文已影响32人  小谷先生

背景

测试方法

    GET https://httpbin.org/ip
    Accept: application/json
    ### Authorization by token, part 1. Retrieve and save token.
    POST https://httpbin.org/post
    Content-Type: application/json
    
    {
      "token": "my-secret-token"
    }
    
    > {% client.global.set("auth_token", response.body.json.token); %}
    ### Send POST request with json body
    POST https://httpbin.org/post
    Content-Type: application/json
    
    {
      "id": 999,
      "value": "content"
    }
    
    ### Send POST request with body as parameters
    POST https://httpbin.org/post
    Content-Type: application/x-www-form-urlencoded
    
    id=999&value=content
    
    ### Send a form with the text and file fields
    POST https://httpbin.org/post
    Content-Type: multipart/form-data; boundary=WebAppBoundary
    
    --WebAppBoundary
    Content-Disposition: form-data; name="element-name"
    Content-Type: text/plain
    
    Name
    --WebAppBoundary
    Content-Disposition: form-data; name="data"; filename="data.json"
    Content-Type: application/json
    
    < ./request-form-data.json
    --WebAppBoundary--

参考资料

上一篇 下一篇

猜你喜欢

热点阅读