go-idem-proxy

command module
v0.0.0-...-176d832 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

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=<value_of_the_header> (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

Documentation

Overview

Copyright © 2020 NAME HERE <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL