Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat/http transcoding (Continuation) (#351)
* minimal working example * return correct content-type when codec is JSON * support default rpc options arg * add custom protoc plugin * include api extensions * include http options in helloworld example * dont pack message if the method was called as a transcode req * wip! build route from HttpRule * update helloworld example with HttpRule options * rename mod to transcode * fix! match rpc options in stub * encode segments to path * expose routes from server Routes are fetched from server and compiled into a dispatch conf. Instead of finding a matching server in the handler the path is matched and the handler is called with the correct server. * init http/json transcode integration tests * merge path bindings with body * http rule template lexer / parse rename literal -> identifier * fix warnings * fix! merge request params before decoding into struct * update example curl requests * Fix typo in filenames * minimal working example * return correct content-type when codec is JSON * support default rpc options arg * add custom protoc plugin * include api extensions * include http options in helloworld example * dont pack message if the method was called as a transcode req * wip! build route from HttpRule * update helloworld example with HttpRule options * rename mod to transcode * fix! match rpc options in stub * encode segments to path * expose routes from server Routes are fetched from server and compiled into a dispatch conf. Instead of finding a matching server in the handler the path is matched and the handler is called with the correct server. * init http/json transcode integration tests * merge path bindings with body * http rule template lexer / parse rename literal -> identifier * fix warnings * fix! merge request params before decoding into struct * update example curl requests * include http method in __call_rpc__ This enables to differentiate to transcoded calls which has the same URL path but different request methods * add query decoder * include query string in request mapping * map request using HttpRule.body * comply to request mapping rules by checking HttpRule.body param * support newline delimeted json for transcoded server streams * base generator on protobuf 0.11.0 * map transcoded response using HttpRule.response_body * support nested field paths in http paths * Fix! parse sub-paths for variable assignment * support calling grpc method with json if http_transcode == true * remove params from template parsing * add GRPC.Server transcode example * get requests can use accept header to find codec * remove reference to HttpRule type * rm protoc plugin in favour of protobuf_generate * add new cowboy router middleware The default routing in cowboy is not capable enough to express 'complex' routes on the form `/v1/{a=shelves/*}/books/**`. The added router is derived from `:cowboy_router` but implements new matching to allow to match on the above statement. * move routing specific func. to GRPC.Server.Router * don't generate protos before tests * reset helloworld example * add helloworld_transcode example * include google api protos in tests only * map gRPC code -> http status * Minor adjusts * Adjusts * Fix. Assert payload * Remove deprecated and fix some tests * Fix. status handler test * Update lib/grpc/codec/json.ex * Update lib/grpc/codec/json.ex * Update lib/grpc/server.ex * Update lib/grpc/transport/http2.ex * Update lib/grpc/server/transcode.ex * chore: remove prometheus stray deps --------- Co-authored-by: Simon Thörnqvist <simon.thornqvist@erlang-solutions.com> Co-authored-by: Paulo Valente <16843419+polvalente@users.noreply.github.com>
- Loading branch information