https://github.com/err0r500/go-idem-proxy
a dead simple HTTP proxy bringing idempotency to POST requests
https://github.com/err0r500/go-idem-proxy
Last synced: 6 months ago
JSON representation
a dead simple HTTP proxy bringing idempotency to POST requests
- Host: GitHub
- URL: https://github.com/err0r500/go-idem-proxy
- Owner: err0r500
- License: gpl-3.0
- Created: 2020-02-22T19:32:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-03-03T16:04:34.000Z (over 6 years ago)
- Last Synced: 2024-06-20T15:51:44.593Z (about 2 years ago)
- Language: Go
- Homepage:
- Size: 42 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go Idem Proxy
an HTTP proxy to get idempotency on POST requests
Run
```
go-idem-proxy --redis-url=redis:6379 --target-url=http://localhost:3000
```
- The proxy will expect an `X-idem-token` header (can be overriden with `IDEM_TOKEN=myHeader` env var) on every POST request
if it's not present :
- it will reject the request with a 400
- Otherwise, it will check if there's something at the key= (in the Redis database)
If there's something:
- it will return the cached response without forwarding the request
- Otherwise, it will forward the request and store the response for later use.
NB : the default `TTL` is set at 60 seconds, you can override that with `CACHE_TTL` env var
## Run Unit tests
```
go test ./...
```
## Run Integration & Unit tests
```
go test ./... -tags=integration
```