Nothing Special   »   [go: up one dir, main page]

Skip to content

This is very simple golang http mock server based on gorilla/mux

Notifications You must be signed in to change notification settings

rukavina/mockgo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mock GO

This is very simple golang http mock server based on gorilla/mux.

Install

go get -u github.com/rukavina/mockgo

Configuration

It's expected to have config.json in the same folder as executable. Eg:

{
    "description": "Test mock definitions",
    "endpoints":[
        {
            "request":{
                "path": "/hello"
            },
            "response":{
                "bodyFileName": "responses/hello.json"
            } 
        },
        {
            "request":{
                "path": "/hello2"
            },
            "response":{
                "body": "{\"text\": \"Hello\",\"name\": \"World\"}",
                "headers": {
                    "Content-Type":"application/json"
                }
            } 
        }        
    ]
}

The request.path defines the url at which the mock serves responses. It's gorilla mux'es path definition. Request routing can be further specified via request fields like: scheme,host,method,query,headers.

Response data can be either defined inline via body or as external file in bodyFileName.

About

This is very simple golang http mock server based on gorilla/mux

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages