File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -140,13 +140,18 @@ def next(self):
140
140
if chunk is None :
141
141
return chunk
142
142
chunk = chunk .decode (self ._encoding ).strip ('\r \n ,' )
143
- if chunk .startswith ('{"total_rows"' ):
144
- chunk += ']}'
143
+ if "total_rows" in chunk :
144
+ # couchdb 1.x (and 2.x?)
145
+ if chunk .startswith ('{' ):
146
+ chunk += ']}'
147
+ # couchbase sync gateway 1.x
148
+ elif chunk .endswith ('}' ):
149
+ chunk = '{' + chunk
145
150
event = json .loads (chunk )
146
151
self ._total_rows = event ['total_rows' ]
147
152
self ._offset = event .get ('offset' )
148
153
return (yield from self .next ())
149
- elif chunk .startswith (('{"rows"' , ']} ' )):
154
+ elif chunk .startswith (('{"rows"' , ']' )):
150
155
return (yield from self .next ())
151
156
elif not chunk :
152
157
return (yield from self .next ())
You can’t perform that action at this time.
0 commit comments