码迷,mamicode.com
首页 > 其他好文 > 详细

wiremock docker 快速生成伪服务器端

时间:2020-01-16 00:52:34      阅读:95      评论:0      收藏:0      [点我收藏+]

标签:response   doc   服务   dock   test   col   vol   ports   tar   

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"
      }
    }
  }

wiremock docker 快速生成伪服务器端

标签:response   doc   服务   dock   test   col   vol   ports   tar   

原文地址:https://www.cnblogs.com/nhz-M/p/12199331.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!