comparison tests/test-wireproto-command-pushkey.t @ 37721:f7673845b167

wireprotov2: decode responses to their expected types Callers of established wire protocol commands expect the response from that command to be decoded into a data structure. It's not very useful if callers get back a stream of bytes and don't know how they should be interpreted - especially since that stream of bytes varies by wire protocol and even the transport within that protocol version. This commit establishes decoding functions for various command responses so callers of those commands get the response type they expect. In theory, this should make the version 2 HTTP peer usable for various operations. But I haven't tested to confirm. Differential Revision: https://phab.mercurial-scm.org/D3381
author Gregory Szorc <gregory.szorc@gmail.com>
date Sat, 14 Apr 2018 11:49:06 -0700
parents a656cba08a04
children 89a16704114c
comparison
equal deleted inserted replaced
37720:d715a85003c8 37721:f7673845b167
51 s> \xf5 51 s> \xf5
52 s> \r\n 52 s> \r\n
53 received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob) 53 received frame(size=*; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) (glob)
54 s> 0\r\n 54 s> 0\r\n
55 s> \r\n 55 s> \r\n
56 response: [True] 56 response: True
57 57
58 $ sendhttpv2peer << EOF 58 $ sendhttpv2peer << EOF
59 > command listkeys 59 > command listkeys
60 > namespace bookmarks 60 > namespace bookmarks
61 > EOF 61 > EOF
82 s> \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0 82 s> \xa1A@X(426bada5c67598ca65036d57d9e4b64b0c1ce7a0
83 s> \r\n 83 s> \r\n
84 received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor) 84 received frame(size=45; request=1; stream=2; streamflags=stream-begin; type=bytes-response; flags=eos|cbor)
85 s> 0\r\n 85 s> 0\r\n
86 s> \r\n 86 s> \r\n
87 response: [{b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'}] 87 response: {b'@': b'426bada5c67598ca65036d57d9e4b64b0c1ce7a0'}
88 88
89 $ cat error.log 89 $ cat error.log