https://github.com/sendya/webmock
mock HTTP server in go and lua
https://github.com/sendya/webmock
Last synced: 2 months ago
JSON representation
mock HTTP server in go and lua
- Host: GitHub
- URL: https://github.com/sendya/webmock
- Owner: sendya
- License: mit
- Created: 2024-03-15T16:46:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-15T16:58:12.000Z (over 2 years ago)
- Last Synced: 2025-03-11T04:35:36.674Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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)
```