MCPcopy Create free account
hub / github.com/gavv/httpexpect / Rewind

Method Rewind

body_wrapper.go:134–156  ·  view source on GitHub ↗

Rewind reading to the beginning.

()

Source from the content-addressed store, hash-verified

132
133// Rewind reading to the beginning.
134func (bw *bodyWrapper) Rewind() {
135 bw.mu.Lock()
136 defer bw.mu.Unlock()
137
138 // Rewind is no-op if disabled.
139 if bw.isRewindDisabled {
140 return
141 }
142
143 // Rewind is no-op until first read operation.
144 if !bw.isReadBefore {
145 return
146 }
147
148 // If HTTP response is not fully read yet, do it now.
149 // If error occurs, it will be reported next read operation.
150 if !bw.isFullyRead {
151 _ = bw.httpReadFull()
152 }
153
154 // Reset memory reader.
155 bw.memReader = bytes.NewReader(bw.memBytes)
156}
157
158// Create new reader to retrieve body contents.
159// New reader always reads body from the beginning.

Callers 7

TestBodyWrapper_RewindFunction · 0.80
TestBodyWrapper_GetBodyFunction · 0.80
TestBodyWrapper_MemoryFunction · 0.80
retryRequestMethod · 0.80
getContentMethod · 0.80

Calls 3

httpReadFullMethod · 0.95
LockMethod · 0.80
UnlockMethod · 0.80

Tested by 5

TestBodyWrapper_RewindFunction · 0.64
TestBodyWrapper_GetBodyFunction · 0.64
TestBodyWrapper_MemoryFunction · 0.64