Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/sendya/webmock
- Owner: sendya
- License: mit
- Created: 2024-03-15T16:46:51.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-03-15T16:58:12.000Z (8 months ago)
- Last Synced: 2024-06-19T16:31:56.521Z (5 months 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)
```