wiremock docker 快速生成伪服务器端

mkdir  -p  /opt/mock/mappings
docker run -d  --name wiremock  -v   /opt/mock/mappings:/home/wiremock/mappings -p 9999:8080   rodolpheche/wiremock:latest


OR

mkdir mappings vim docker
-compose.yml version: '2.4'
services:
  mock:
    image: "rodolpheche/wiremock"
    restart: always
    #network_mode: "host"
    ports:
      - 9999:8080
    volumes:
      - ./mappings:/home/wiremock/mappings

目录结构

./
├── docker-compose.yml
└── mappings
    └── users.json

json 范例     访问   http://localhost:9999/users

{
    "request": {
      "method": "GET",
      "url": "/users"
    },
    "response": {
      "status": 200,
      "jsonBody": [
        {
          "name":"dalong",
           "appversion":"v1"
        },
        {
          "name":"login",
          "appversion":"v1"
      },
      {
          "name":"user",
          "appversion":"v1"
      }
    ],
      "headers": {
          "Content-Type": "application/json"
      }
    }
  }
发布了93 篇原创文章 · 获赞 4 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览