{"id":22870265,"url":"https://github.com/berquerant/jsonhttp","last_synced_at":"2025-03-31T11:26:06.086Z","repository":{"id":81890019,"uuid":"404834732","full_name":"berquerant/jsonhttp","owner":"berquerant","description":"A http server for testing.","archived":false,"fork":false,"pushed_at":"2021-09-09T18:47:14.000Z","size":34,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-06T16:57:56.389Z","etag":null,"topics":["go"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/berquerant.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-09T18:46:53.000Z","updated_at":"2021-09-09T18:48:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"db5dddc9-5b0f-458b-ab28-fd536a7d0c93","html_url":"https://github.com/berquerant/jsonhttp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fjsonhttp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fjsonhttp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fjsonhttp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/berquerant%2Fjsonhttp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/berquerant","download_url":"https://codeload.github.com/berquerant/jsonhttp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246460284,"owners_count":20781080,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go"],"created_at":"2024-12-13T13:14:20.907Z","updated_at":"2025-03-31T11:26:06.065Z","avatar_url":"https://github.com/berquerant.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsonhttp\n\nA http server for testing.\n\n# Usage\n\n```\n% jsonhttp -h\nUsage of dist/jsonhttp:\n  -c string\n        config file (default \"server.json\")\n  -debug\n        enable debug log\n  -p int\n        port number\n```\n\nThe format of `config file` is `message Server` in `pb/origin.proto`.\n\n## Hello\n\n```\n{\n  \"handlers\": [\n    {\n      \"path\": \"/hello\",\n      \"methodType\": \"GET\",\n      \"action\": {\n        \"return\": {\n          \"status\": 200,\n          \"templates\": [\n            {\n              \"type\": \"BODY\",\n              \"value\": {\n                \"m\": {\n                  \"values\": {\n                    \"message\": {\n                      \"s\": \"Hello!\"\n                    }\n                  }\n                }\n              }\n            }\n          ]\n        }\n      }\n    }\n  ]\n}\n```\n\n## Echo with random delay\n\n```\n{\n  \"handlers\": [\n    {\n      \"path\": \"/echo\",\n      \"methodType\": \"GET\",\n      \"action\": {\n        \"return\": {\n          \"status\": 200,\n          \"delay\": {\n            \"util\": {\n              \"random\": {\n                \"dice\": {\n                  \"min\": 200,\n                  \"max\": 1000\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  ]\n}\n```\n\n## Proxy\n\n```\n{\n  \"handlers\": [\n    {\n      \"path\": \"/gw\",\n      \"methodType\": \"GET\",\n      \"action\": {\n        \"gateway\": {\n          \"path\": {\n            \"s\": \"http://127.0.0.1:10000/hello\"\n          },\n          \"methodType\": \"GET\",\n          \"timeout\": {\n            \"n\": 300\n          }\n        }\n      }\n    }\n  ]\n}\n```\n\n## Dynamic proxy\n\n```\n{\n  \"handlers\": [\n    {\n      \"path\": \"/dgw\",\n      \"methodType\": \"POST\",\n      \"action\": {\n        \"gateway\": {\n          \"path\": {\n            \"add\": {\n              \"values\": [\n                {\n                  \"s\": \"http://127.0.0.1:\"\n                },\n                {\n                  \"body\": {\n                    \"keys\": [\"port\"]\n                  }\n                },\n                {\n                  \"s\": \"/hello\"\n                }\n              ]\n            }\n          },\n          \"methodType\": \"GET\"\n        }\n      }\n    }\n  ]\n}\n```\n\n# Build\n\n```\nmake build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fjsonhttp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fberquerant%2Fjsonhttp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fberquerant%2Fjsonhttp/lists"}