mock

package
v6.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package mock 根据 doc 生成 mock 数据

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(h *message.Handler, path string, servers map[string]string) (http.Handler, error)

Load 从本地或是远程加载文档内容

func New

func New(h *message.Handler, d *doc.Doc, servers map[string]string) (http.Handler, error)

New 声明 Mock 对象

h 用于处理各类输出消息,仅在 ServeHTTP 中的消息才输出到 h; d doc.Doc 实例,调用方需要保证该数据类型的正确性; servers 用于指定 d.Servers 中每一个服务对应的路由前缀

Types

type Mock

type Mock struct {
	// contains filtered or unexported fields
}

Mock 管理 mock 数据

func (*Mock) ServeHTTP

func (m *Mock) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL