{"id":13413830,"url":"https://github.com/camgraff/protoxy","last_synced_at":"2025-05-05T16:44:49.854Z","repository":{"id":56425629,"uuid":"292700890","full_name":"camgraff/protoxy","owner":"camgraff","description":"A proxy server than converts JSON request bodies to protocol buffers","archived":false,"fork":false,"pushed_at":"2020-11-08T21:25:43.000Z","size":114,"stargazers_count":35,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-07-31T20:52:54.626Z","etag":null,"topics":["go","golang","postman","protobuf","protocol-buffers","rest","rest-api"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/camgraff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-09-03T23:24:34.000Z","updated_at":"2024-05-27T11:17:24.000Z","dependencies_parsed_at":"2022-08-15T18:30:52.468Z","dependency_job_id":null,"html_url":"https://github.com/camgraff/protoxy","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camgraff%2Fprotoxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camgraff%2Fprotoxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camgraff%2Fprotoxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/camgraff%2Fprotoxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/camgraff","download_url":"https://codeload.github.com/camgraff/protoxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252535450,"owners_count":21763963,"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","golang","postman","protobuf","protocol-buffers","rest","rest-api"],"created_at":"2024-07-30T20:01:50.597Z","updated_at":"2025-05-05T16:44:49.823Z","avatar_url":"https://github.com/camgraff.png","language":"Go","readme":"# Welcome to Protoxy 👋\n[![codecov](https://codecov.io/gh/camgraff/protoxy/branch/master/graph/badge.svg)](https://codecov.io/gh/camgraff/protoxy)\n[![Go Report Card](https://goreportcard.com/badge/github.com/camgraff/protoxy)](https://goreportcard.com/report/github.com/camgraff/protoxy)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](#)\n\n## What is Protoxy?\nProtoxy allows you to test your REST APIs that use [Protocol Buffer](https://developers.google.com/protocol-buffers) serialization through Postman and other API testing tools which do not natively support Protobuf encoding. Protoxy is a proxy server that converts the JSON in your request body to the appropriate Protobuf message type and transforms the response from your back-end back into JSON. You don't need to make any changes to your source code to use Protoxy.\n\n## Install\n\n```\ngo get github.com/camgraff/protoxy\n```\n\n## Usage\nConsider a proto file located at `./protos/example.proto` that looks like this:\n\n```\nsyntax = \"proto3\";\npackage example;\n\nmessage ExampleRequest {\n    string text = 1;\n    int32 number = 2;\n    repeated string list = 3;\n}\n\nmessage ExampleResponse {\n    string text = 1;\n}\n\n```\n\n1. Start the server by specifying your import paths, proto file names, and optional port.\n\n    ```\n    protoxy -I ./protos/ --port 7777 example.proto\n    ```\n\n2. Configure Postman to send requests through the Proxy server.\n    ![Postman proxy config](https://raw.githubusercontent.com/camgraff/protoxy/master/media/postman-config.png)\n\n3. Add your fully-qualified message names as params in the Content-Type header.\n\n    ```\n    Content-Type: application/x-protobuf; reqMsg=\"example.ExampleRequest\"; respMsg=\"example.ExampleResponse\";\n    ```\n\n4. Send your request as a raw JSON body.\n\n    ```\n    {\n      \"text\": \"some text\",\n      \"number\": 123,\n      \"list\": [\"this\", \"is\", \"a\", \"list\"]\n    }\n    ```\n\n    The response is:\n\n    ```\n    {\n      \"text\": \"this response was automagically converted to JSON\"\n    }\n    ```\n\n### Using Protobuf in Query String\n\nProtoxy also supports sending protobuf messages as a base64 encoded query string in the URL. To do this, add an additional param `qs` in the header whose value corresponds to the query string parameter. For example:\n\n```\nContent-Type: application/x-protobuf; reqMsg=\"example.ExampleRequest\"; respMsg=\"example.ExampleResponse\"; qs=\"proto_body\";\n```\n\nThis will result in a URL like:\n\n```\nhttp://example.com?proto_body={base64 encoding of example.ExampleRequest}\n```\n\n### Handling Multiple Response Message Types\nIf your API sends multiple response message types, the `respMsg` parameter accepts a comma-seperated list of values.\n\n```\nContent-Type: application/x-protobuf; reqMsg=\"example.ExampleRequest\"; respMsg=\"example.ExampleResponse,example.DifferentResponse\";\n```\n\nNote: Protoxy will attempt to unmarshal your proto messages into each type of response and will send the first successful one. This can produce unexpected results because the same wire-format message can successfully be unmarshalled into multiple proto message types depending on the fields in the proto message. If possible, it is best to ensure that you back-end server returns only one response type per route.\n\n\n## Author\n\n👤 **Cam Graff**\n\n* Github: [@camgraff](https://github.com/camgraff)\n* LinkedIn: [@camgraff](https://linkedin.com/in/camgraff)\n\n## 🤝 Contributing\n\nContributions, issues and feature requests are welcome!\n\nFeel free to check [issues page](https://github.com/camgraff/protoxy/issues). \n\n## Show your support\n\nGive a ⭐️ if this project helped you!\n\n\n***\n","funding_links":[],"categories":["服务端应用","服务器应用程序","Server Applications","Relational Databases"],"sub_categories":["查询语","HTTP客户端","HTTP Clients"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamgraff%2Fprotoxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcamgraff%2Fprotoxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcamgraff%2Fprotoxy/lists"}