Commit Graph

26 Commits

Author SHA1 Message Date
Asim Aslam
784a89b488 Allow bytes.Frame to be set to sent just bytes 2019-01-16 15:27:57 +00:00
Asim Aslam
c1d0237370 Add client response 2019-01-14 21:30:43 +00:00
Asim Aslam
36788487a7 set headers as appropriate 2019-01-11 13:44:47 +00:00
Asim Aslam
9adebfcf1e rename method to endpoint 2019-01-10 21:25:31 +00:00
Asim Aslam
d004c9624b Add router modifications 2019-01-09 16:20:57 +00:00
Asim Aslam
7a1f735825 remove server codec 2019-01-09 09:02:30 +00:00
Asim Aslam
4cb41721f1 further codec changes 2019-01-08 15:38:25 +00:00
Asim Aslam
c9963cb870 rename 2019-01-07 18:20:47 +00:00
Asim Aslam
d179c971af Switch default codec and add default codec for server 2019-01-07 13:48:38 +00:00
Asim Aslam
5aeb28dfee Add error header 2019-01-07 09:11:36 +00:00
Asim Aslam
ed580204a8 Add grpc codec 2019-01-02 12:55:06 +00:00
Asim Aslam
e2623d8ef5 Make json/protobuf codecs 2018-12-31 22:01:16 +00:00
Asim Aslam
34ed5235a3 rename rpc codec 2018-11-23 20:05:31 +00:00
Hao Lian
d4b149046f server/rpc_codec: if c.codec.Write fails, reset write buffer and encode an error message about the encoding failure
When developing go-micro services, it is frequently possible to set invalid results in the response pointer. When this happens (as I and @trushton personally experienced), `sendResponse()` returns an error correctly explaining what happened (e.g. protobuf refused to encode a bad struct) but the `call()` function one above it in the stack ignores the returned error object.

Thus, invalid structs go un-encoded and the _client side times out_. @trushton and I first caught this in our CI builds when we left a protobuf.Empty field uninitialized (nil) instead of setting it to `&ptypes.Empty{}`. This resulted in an `proto: oneof field has nil value` error, but it was dropped and became a terribly confusing client timeout instead.

This patch is two independent changes:

* In rpc_codec, when a serialization failure occurs serialize an error message, which will correctly become a 500 for HTTP services, about the encoding failure. This means rpc_codec only returns an `error` when a socket failure occurs, which I believe is the behavior that rpc_service is expecting anyway.

* In rpc_service, log any errors returned by sendResponse instead of dropping the error object. This will make debugging client timeouts less of a hassle.
2017-07-17 14:21:43 -04:00
Asim
d306559d8f Nitpick Headers to Header 2016-01-28 18:11:13 +00:00
Asim
3b295b16e7 Working bidirectional streaming example 2015-12-18 20:28:50 +00:00
Asim
ba3b056e76 add headers 2015-12-16 02:15:09 +00:00
Asim
0c9f8411bb Pull rpcplus in local for the time being. We need to modify it for server side middleware 2015-12-01 23:32:23 +00:00
Asim
dddcdc34ed rename to protorpc and jsonrpc 2015-11-28 18:54:38 +00:00
Asim
80f53ab176 Add json codec 2015-11-28 18:40:32 +00:00
Asim
654728027b Updated codec interface and code. Painful stuff 2015-11-28 11:22:29 +00:00
Asim
12a1e1eeda Add pluggable codec support 2015-11-25 19:50:05 +00:00
Asim
5d88115f2a update links from myodc to micro 2015-11-20 16:17:33 +00:00
Asim
6b8855a337 Fix client rpc codec 2015-10-16 11:15:17 +01:00
Asim
0adc0e3c00 Fix rpc codec issue stopping json requests from working 2015-10-15 22:06:43 +01:00
Asim
09c784d294 add support for streaming requests. cleanup watcher initilisation 2015-06-01 18:55:27 +01:00