You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2020. It is now read-only.
@@ -17,46 +16,44 @@ Create a json file with a list of your endpoints like so:
17
16
{
18
17
"url": "/foo/bar",
19
18
"verb": "GET",
20
-
"response_payload": {
21
-
"foo": "bar",
22
-
"fizz": "buzz"
23
-
},
24
-
"response_code": 200
25
-
},
26
-
{
27
-
"url": "/herp/derp",
28
-
"verb": "POST",
29
-
"response_payload": [
19
+
"responses": [
20
+
{
21
+
"headers": {
22
+
"X-Herp": "DDDERP"
23
+
},
24
+
"payload": {
25
+
"foo": "bar",
26
+
"fizz": "buzz"
27
+
},
28
+
"status_code": 200
29
+
},
30
30
{
31
-
"duck": 1,
32
-
"cow": true,
33
-
"pig": null
31
+
"headers": {
32
+
"X-Herp": "HHHERP"
33
+
},
34
+
"payload": {
35
+
"foo": "bark",
36
+
"fizz": "moo"
37
+
},
38
+
"status_code": 201
34
39
}
35
-
],
36
-
"response_code": 200
37
-
},
38
-
{
39
-
"url": "/i/am/a/teapot",
40
-
"verb": "GET",
41
-
"response_payload": {},
42
-
"response_code": 418
40
+
]
43
41
}
44
42
]
45
43
}
46
44
```
47
45
46
+
For each endpoint, the url and verb are required. There must also be at least one response per endpoint as well.
47
+
48
+
If you have multiple responses for the same endpoint, you can specify which one to return in the headers of your request. To do this, set a header called `X-Fony-Index` to the index of the response you wish to return. If you pass an index out of range, the response at index `0` will be returned.
49
+
48
50
Use `docker-compose` to run the `fony` command. Be sure to set the `GOBIN` environment variable to `/go/bin`.
49
51
See the `docker-compose.yml` file in this repository for an example.
50
52
51
53
## Things that need done
52
54
- All the tests
53
55
54
-
## Known bugs
55
-
Headers are not parsing properly at the moment
56
-
57
-
## Future enhancements
58
-
Right now there can only be one call per endpoint/http verb combo.
59
-
We need to be able to allow multiple responses for each endpoint/http verb.
60
-
61
-
One proposed solution would be push a list of response payloads to the endpoint, and return them sequentially.
62
-
I will revisit this if the need arises.
56
+
## Caveats
57
+
This project is meant to run in a Docker container. The necessary go dependencies will be installed when the Dockerfile is built. If you want to run this program locally, you will need to install the following dependencies via `go get`:
0 commit comments