##// END OF EJS Templates
wireprotoserver: convert ErrorResponse to bytes...
Matt Harbison -
r47524:71443f74 stable
parent child Browse files
Show More
@@ -24,6 +24,7 b' from .interfaces import util as interfac'
24 24 from .utils import (
25 25 cborutil,
26 26 compression,
27 stringutil,
27 28 )
28 29
29 30 stringio = util.stringio
@@ -233,10 +234,12 b' def handlewsgirequest(rctx, req, res, ch'
233 234 except hgwebcommon.ErrorResponse as e:
234 235 for k, v in e.headers:
235 236 res.headers[k] = v
236 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
237 res.status = hgwebcommon.statusmessage(
238 e.code, stringutil.forcebytestr(e)
239 )
237 240 # TODO This response body assumes the failed command was
238 241 # "unbundle." That assumption is not always valid.
239 res.setbodybytes(b'0\n%s\n' % pycompat.bytestr(e))
242 res.setbodybytes(b'0\n%s\n' % stringutil.forcebytestr(e))
240 243
241 244 return True
242 245
@@ -88,7 +88,9 b' def handlehttpv2request(rctx, req, res, '
88 88 try:
89 89 checkperm(rctx, req, b'pull' if permission == b'ro' else b'push')
90 90 except hgwebcommon.ErrorResponse as e:
91 res.status = hgwebcommon.statusmessage(e.code, pycompat.bytestr(e))
91 res.status = hgwebcommon.statusmessage(
92 e.code, stringutil.forcebytestr(e)
93 )
92 94 for k, v in e.headers:
93 95 res.headers[k] = v
94 96 res.setbodybytes(b'permission denied')
General Comments 0
You need to be logged in to leave comments. Login now