Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sendya/webmock

mock HTTP server in go and lua
https://github.com/sendya/webmock

Last synced: about 5 hours ago
JSON representation

mock HTTP server in go and lua

Awesome Lists containing this project

README

        

webmock
---

### Usage

```go
$ go run main.go
```

### New Handler

```lua
local router = require('router')

router.handle("/path/to", function(req, res)
-- show host
print(req.host)

res.header("X-Test-Name", "aaabbcc")
res.write('OK')
end)

router.handle("/4xx", function(req, res)
res.header("X-Test-Name", "required Authorization")
res.write_header(401)
res.write('')
end)
```