ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
[TOC] ## 接口说明 > 新增一个 stub mapping 。 ## 接口定义 请求入参,参见 Request JSON Schema 。 ~~~[api] post:/mappings <<< request(success) **Request Body** { "name": "wiremock create a stub example", "priority": 5, "persistent": true, "request": { "method": "POST", "urlPath": "/thing/100", "headers": { "Accept": { "contains": "json" } }, "cookies": { "X-Auth-Token": { "equalTo": "123usidsldie98le" } } }, "response": { "status": 200, "headers": { "Content-Type": "application/json" }, "delayDistribution": { "lower": "100", "upper": "300", "type": "uniform" }, "body": "{\n \"test\":\"liyun\",\n \"node\":{\n \"subnode\":\"subnodevalue\"\n }\n}", "transformers": ["response-template"] }, "scenarioName": "订单", "requiredScenarioState": "Started", "newScenarioState": "second" } <<< response(success) **Response Body** { "id" : "03ba2797-e4f3-46f8-a680-fee52ac7ce1e", "name" : "wiremock create a stub example", "request" : { "urlPath" : "/thing/100", "method" : "POST", "headers" : { "Accept" : { "contains" : "json" } }, "cookies" : { "X-Auth-Token" : { "equalTo" : "123usidsldie98le" } } }, "response" : { "status" : 200, "body" : "{\n \"test\":\"liyun\",\n \"node\":{\n \"subnode\":\"subnodevalue\"\n }\n}", "headers" : { "Content-Type" : "application/json" }, "delayDistribution" : { "type" : "uniform", "lower" : 100, "upper" : 300 }, "transformers" : [ "response-template" ] }, "uuid" : "03ba2797-e4f3-46f8-a680-fee52ac7ce1e", "persistent" : true, "priority" : 5, "scenarioName" : "订单", "requiredScenarioState" : "Started", "newScenarioState" : "second" } ~~~ ## [JSON Schema](https://jsonschema.net/) ### Request JSON Schema 同 [Stub Mapping](StubMapping.md) 。 ### Response JSON Schema 同 [Stub Mapping](StubMapping.md) 。