-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
360b3c4
commit d1b88ae
Showing
7 changed files
with
714 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
# PrioBike Shlink Guard | ||
|
||
This is a proxy that can be used in front of the Shlink to make sure that only valid requests and espacially valid long links are sent to the Shlink. | ||
|
||
## Quickstart | ||
|
||
Run locally: | ||
```bash | ||
docker-compose up | ||
``` | ||
|
||
Run tests: | ||
```bash | ||
curl -X POST --header "X-Api-Key: secret" -H "Content-Type: application/json" -d @example_long_link.json http://localhost/rest/v3/short-urls | ||
go test | ||
``` | ||
|
||
Then | ||
### POST | ||
|
||
Should not work: | ||
```bash | ||
curl -X POST --header "X-Api-Key: secret" -H "Content-Type: application/json" -d @example_long_link_base64_invalid.json http://localhost/rest/v3/short-urls | ||
``` | ||
|
||
Should work: | ||
```bash | ||
curl -X GET --header "X-Api-Key: secret" -H "Content-Type: application/json" -d @example_long_link.json http://localhost/rest/v3/short-urls/<shortcode> | ||
curl -X POST --header "X-Api-Key: secret" -H "Content-Type: application/json" -d @example_long_link_shortcut_location.json http://localhost/rest/v3/short-urls | ||
``` | ||
|
||
### GET | ||
|
||
Should not work: | ||
```bash | ||
curl -X GET --header "X-Api-Key: secret" -H "Content-Type: application/json" http://localhost/rest/v3/short-urls | ||
``` | ||
|
||
Should work (if short link exists): | ||
```bash | ||
curl -X GET --header "X-Api-Key: secret" -H "Content-Type: application/json" http://localhost/rest/v3/short-urls/segrs4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module shlink-guard | ||
|
||
go 1.21.3 |
Oops, something went wrong.