forked from quic-go/quic-go
add DataLen function to StreamFrame
This commit is contained in:
@@ -203,3 +203,8 @@ func (f *StreamFrame) MinLength() (protocol.ByteCount, error) {
|
||||
|
||||
return length + 1, nil
|
||||
}
|
||||
|
||||
// DataLen gives the length of data in bytes
|
||||
func (f *StreamFrame) DataLen() protocol.ByteCount {
|
||||
return protocol.ByteCount(len(f.Data))
|
||||
}
|
||||
|
||||
@@ -377,4 +377,13 @@ var _ = Describe("StreamFrame", func() {
|
||||
Expect(f.getOffsetLength()).To(Equal(protocol.ByteCount(8)))
|
||||
})
|
||||
})
|
||||
|
||||
Context("DataLen", func() {
|
||||
It("determines the length of the data", func() {
|
||||
frame := StreamFrame{
|
||||
Data: []byte("foobar"),
|
||||
}
|
||||
Expect(frame.DataLen()).To(Equal(protocol.ByteCount(6)))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user