moco模拟post主要的四类请求

1、application/x-www-form-urlencoded

{
    "description": "application/x-www-form-urlencoded",
    "request": {
      "method": "post",
      "uri": "/",
      "forms": {
        "name": "a",
        "age": "1"
      }
    },
    "response": {
      "text": "我是application/x-www-form-urlencoded"
    }
  }

2、multipart/form-data

  {
    "description": "multipart/form-data",
    "request": {
      "method": "post",
      "uri": "/",
      "forms": {
        "name": "b",
        "age": "2"
      }
    },
    "response": {
      "text": "我是multipart/form-data"
    }
  }

3、application/json

{
    "description": "application/json",
    "request": {
      "method": "post",
      "headers": {
        "content-type": "application/json"
      },
      "uri": "/",
      "json": {
        "name": "c",
        "age": "3"
      }
    },
    "response": {
      "text": "我是application/json"
    }

4、text/xml

  {
    "description": "text/xml",
    "request": {
      "method": "post",
      "headers": {
        "content-type": "application/xml"
      },
      "uri": "/",
      "text": {
        "xml": "d4"
      }
    },
    "response": {
      "text": "我是application/xml"
    }

发现了没有,application/x-www-form-urlencoded 和 multipart/form-data 完全一样,不过区别在于请求的时候,参数放置在不同地方,可以看上面的截图

原文链接:https://blog.csdn.net/qq_40632009/article/details/117714784

猜你喜欢

转载自blog.csdn.net/qq_40632009/article/details/117714784
今日推荐