File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
prometheus_push_client/transports Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,10 @@ def _validate(self): # pragma: no cover
2121
2222 def prepare_data (self , iterable ):
2323 data = b"\n " .join (iterable )
24- to_pad = sum (ord (b"\n " ) != char for char in data [- 2 :])
25- return data .ljust (len (data ) + to_pad , b"\n " ) # ensure ends with "\n\n"
24+ if data .endswith (b"\n \n " ): # pragma: no cover
25+ return data
26+ to_pad = 1 if data [- 1 ] == ord (b"\n " ) else 2
27+ return data .ljust (len (data ) + to_pad , b"\n " )
2628
2729 def push_all_sync (self ):
2830 raise NotImplementedError ("brave proposal" )
@@ -41,7 +43,7 @@ def stop(self):
4143
4244 def push_all (self , iterable ):
4345 data = self .prepare_data (iterable )
44- resp = self .session .request (self .verb , self .url , data = data )
46+ self .session .request (self .verb , self .url , data = data )
4547
4648
4749class AioHttpTransport (BaseHttpTransport ):
You can’t perform that action at this time.
0 commit comments