回答編集履歴
1
具体的なメソッドの実装を追加
test
CHANGED
@@ -15,6 +15,32 @@
|
|
15
15
|
|
16
16
|
|
17
17
|
`*http.body`
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
- メソッド
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```go
|
26
|
+
|
27
|
+
func (b *body) Read(p []byte) (n int, err error) {
|
28
|
+
|
29
|
+
b.mu.Lock()
|
30
|
+
|
31
|
+
defer b.mu.Unlock()
|
32
|
+
|
33
|
+
if b.closed {
|
34
|
+
|
35
|
+
return 0, ErrBodyReadAfterClose
|
36
|
+
|
37
|
+
}
|
38
|
+
|
39
|
+
return b.readLocked(p)
|
40
|
+
|
41
|
+
}
|
42
|
+
|
43
|
+
```
|
18
44
|
|
19
45
|
|
20
46
|
|