mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2024-11-26 22:30:25 +00:00
[chore] Close copied request body in SignDelivery (#3254)
This commit is contained in:
parent
1e0c858a05
commit
88a81fbcaf
1 changed files with 7 additions and 3 deletions
|
@ -175,14 +175,18 @@ func (t *transport) SignDelivery(dlv *delivery.Delivery) error {
|
||||||
return gtserror.New("delivery request body not rewindable")
|
return gtserror.New("delivery request body not rewindable")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a new copy of the request body.
|
// Fetch a fresh copy of request body.
|
||||||
body, err := dlv.Request.GetBody()
|
rBody, err := dlv.Request.GetBody()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return gtserror.Newf("error getting request body: %w", err)
|
return gtserror.Newf("error getting request body: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read body data into memory.
|
// Read body data into memory.
|
||||||
data, err := io.ReadAll(body)
|
data, err := io.ReadAll(rBody)
|
||||||
|
|
||||||
|
// Done with body.
|
||||||
|
_ = rBody.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return gtserror.Newf("error reading request body: %w", err)
|
return gtserror.Newf("error reading request body: %w", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue