36 Commits

Author SHA1 Message Date
Asim Aslam
3a422231f3 remove handler/util package in favour of util/router (#1908) 2021-01-16 00:45:10 +03:00
Asim Aslam
07a08b478f v3 refactor (#1868)
* Move to v3

Co-authored-by: Ben Toogood <bentoogood@gmail.com>
2021-01-16 00:45:10 +03:00
Di Wu
3905686726 fix typo in comments (#1840)
* remove global error tracking

* rpc_server: fix invalid register err

* fix typo

Co-authored-by: Asim Aslam <asim@aslam.me>
2021-01-16 00:45:10 +03:00
5d5644f878 pass request context from request rpc endpoints (#1799)
http middleware can add additional metadata to context,
for example tracing wrappers, pass down it to underlining
services

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
ben-toogood
b8d2c5dd23 Deprecate client/selector (#1767)
* client/{grpc,rpc}: depricate selector (wip)

* {client,cmd}: remove client/selector

* deprecate client/selector

* router/static: fix lookup

* config/cmd: add support for legacy static selector flag

* config/cmd: add support for legacy dns selector flag
2021-01-16 00:45:10 +03:00
4d24368bf5 api/handler/rpc: dont log error on normal websocket error code (#1688)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
cedaae65b7 api/handler/rpc: fix encoding of inner message (#1601)
* api/handler/rpc: fix encoding of inner message

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
0ccd618bb1 bundle qson lib in util (#1561)
* copy qson from https://github.com/joncalhoun/qson
  as author not want to maintain repo
* latest code contains our fix to proper decode strings
  with escaped & symbol
* replace package in api/handler/rpc

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
0656f3b400 api/router/registry: extract path based parameters from url to req (#1530)
* api/router/registry: extract path based parameters from url to req
* api/handler/rpc: fix empty body request parsing
* bundle grpc-gateway util funcs

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
026212486a api/handler/rpc: improvements and fixes (#1535)
* api/handler/rpc: fix empty body case
* api/handler/rpc: copy all request headers to metadata

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
Asim Aslam
2fafc81af7 Remove only allowing certain methods 2021-01-16 00:45:10 +03:00
Asim Aslam
74e32e95f0 fix metadata parsing 2021-01-16 00:45:10 +03:00
Asim Aslam
abbfa17a49 fixup handler tests 2021-01-16 00:45:10 +03:00
Asim Aslam
a26b37aaf9 Strip MetadataKey global var 2021-01-16 00:45:10 +03:00
5e650deb07 api minor improvements (#1526)
* api/handler/rpc: unblock all http methods and set Host meta
* api/router/static: add debug log

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
5b5c73457b api/router/static: allow to specify body dst (#1486)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
bad15af45d api/handler/rpc: fix panic on invalid error conversation (#1483)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
281cced325 api/handler/rpc: not log error on client disconnect (#1482)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
032a936150 api/handler/rpc: binary streaming support (#1466)
* api/handler/rpc: binary streaming support

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fixup

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* fix sec webscoekt protol

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
87e8f5781a api: use http request Clone (#1458)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
2c9996302d api/handler/rpc: dont change types of url fields (#1457)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
a7dd6d9004 api/handler/rpc: correctly parse nested url vars (#1455)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
2c4c352aa2 fix api metadata extract from context (#1452)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
d0a368340a api/handler/rpc: fix metadata cleanup (#1451)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
5376c788db api: add static router and improve path parser in rpc handler (#1437)
* api: add static router and improve path parser in rpc handler

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* expose metadata context key to be able to get unmodified map keys

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* server/grpc: fix jsonpb codec for protobuf msg

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: write 204 status code when rsp is nil

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* api/handler/rpc: add check for nil response for non javascript

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
da31e36f93 api/handler/rpc: process all methods and merge url params to json body (#1427)
* api/handler/rpc: process all methods and merge url params to json body

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>

* add merge json test

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
bf74b4394e api/handler: use http.MaxBytesReader and buffer pool (#1415)
* api/handler: use http.MaxBytesReader

protect api handlers from OOM cases

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
244c9fdb90 api/handler/rpc: log errors (#1390)
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
Asim Aslam
cc8dad8338 add websocket streaming to api rpc handler (#1326) 2021-01-16 00:45:10 +03:00
Asim Aslam
92c875f103 parse url encoded form in rpc handler (#1183)
* parse url encoded form in rpc handler

* Remove comment
2021-01-16 00:45:10 +03:00
43c2711325 fix import paths for v2 release
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
52cd951be7 linting fixes
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
2021-01-16 00:45:10 +03:00
Asim Aslam
d8616f2038 Default to json content-type in api 2021-01-16 00:45:10 +03:00
Asim Aslam
03ebde1372 Go fmt everything 2021-01-16 00:45:10 +03:00
Asim Aslam
fbe4c17b9f Move selector to client/selector 2021-01-16 00:45:10 +03:00
Asim Aslam
10f1bd592f Further consolidate the libraries 2021-01-16 00:45:10 +03:00