wiremock docker 快速生成伪服务器端

Posted NHZ-M BLOG

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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"
      }
    }
  }

以上是关于wiremock docker 快速生成伪服务器端的主要内容,如果未能解决你的问题,请参考以下文章

(07)使用WireMock快速伪造REST服务

SpringBoot18 SwaggerAPI接口文档生成WireMock模拟后台数据

wiremock 基本docker 运行

springboot项目使用WireMock伪造REST服务

使用WireMock伪造REST服务

入门、快速搭建Docker分布式项目环境