Show More
@@ -137,7 +137,7 b' def archive_repo(walker, archive_dest_pa' | |||
|
137 | 137 | |
|
138 | 138 | |
|
139 | 139 | class BinaryEnvelope(object): |
|
140 | def __init__(self, value, bin_type=True): | |
|
140 | def __init__(self, value: bytes, bin_type=True): | |
|
141 | 141 | self.value = value |
|
142 | 142 | self.bin_type = bin_type |
|
143 | 143 |
@@ -72,6 +72,7 b' from mercurial import strip as hgext_str' | |||
|
72 | 72 | |
|
73 | 73 | |
|
74 | 74 | def get_ctx(repo, ref): |
|
75 | if not isinstance(ref, int): | |
|
75 | 76 | ref = safe_bytes(ref) |
|
76 | 77 | try: |
|
77 | 78 | ctx = repo[ref] |
@@ -507,6 +507,7 b' class HTTPApplication(object):' | |||
|
507 | 507 | bin_type = False |
|
508 | 508 | res = value.get('result') |
|
509 | 509 | if res and isinstance(res, BinaryEnvelope): |
|
510 | log.debug('Result is wrapped in BinaryEnvelope type') | |
|
510 | 511 | value['result'] = res.value |
|
511 | 512 | bin_type = res.bin_type |
|
512 | 513 | |
@@ -516,6 +517,8 b' class HTTPApplication(object):' | |||
|
516 | 517 | ct = response.content_type |
|
517 | 518 | if ct == response.default_content_type: |
|
518 | 519 | response.content_type = 'application/x-msgpack' |
|
520 | if bin_type: | |
|
521 | response.content_type = 'application/x-msgpack-bin' | |
|
519 | 522 | |
|
520 | 523 | return msgpack.packb(value, use_bin_type=bin_type) |
|
521 | 524 | return _render |
General Comments 0
You need to be logged in to leave comments.
Login now