2018-09-17 12:41:14 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2011-12-01 17:33:34 -05:00
|
|
|
module Puma
|
2011-12-01 18:23:14 -05:00
|
|
|
# Provides an IO-like object that always appears to contain no data.
|
|
|
|
# Used as the value for rack.input when the request has no body.
|
|
|
|
#
|
2011-12-01 17:33:34 -05:00
|
|
|
class NullIO
|
|
|
|
def gets
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2021-01-04 11:52:23 -05:00
|
|
|
def string
|
|
|
|
""
|
|
|
|
end
|
|
|
|
|
2011-12-01 17:33:34 -05:00
|
|
|
def each
|
|
|
|
end
|
|
|
|
|
2016-11-23 09:32:33 -05:00
|
|
|
# Mimics IO#read with no data.
|
2011-12-01 18:23:14 -05:00
|
|
|
#
|
2016-11-23 09:32:33 -05:00
|
|
|
def read(count = nil, _buffer = nil)
|
2020-03-07 09:15:43 -05:00
|
|
|
count && count > 0 ? nil : ""
|
2011-12-01 17:33:34 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def rewind
|
|
|
|
end
|
|
|
|
|
|
|
|
def close
|
|
|
|
end
|
2016-02-04 23:54:21 -05:00
|
|
|
|
|
|
|
def size
|
|
|
|
0
|
|
|
|
end
|
2016-02-07 17:51:54 -05:00
|
|
|
|
2016-12-12 11:58:36 -05:00
|
|
|
def eof?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2016-02-07 17:51:54 -05:00
|
|
|
def sync=(v)
|
|
|
|
end
|
|
|
|
|
|
|
|
def puts(*ary)
|
|
|
|
end
|
|
|
|
|
|
|
|
def write(*ary)
|
|
|
|
end
|
2011-12-01 17:33:34 -05:00
|
|
|
end
|
|
|
|
end
|