mirror of
https://github.com/safing/portbase
synced 2025-09-01 01:59:48 +00:00
Restore http.Request body for http.HandlerFunc in api package
This commit is contained in:
parent
85f8832911
commit
ba6dee246b
1 changed files with 5 additions and 0 deletions
|
@ -1,9 +1,11 @@
|
|||
package api
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
|
@ -413,6 +415,9 @@ func (e *Endpoint) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
apiRequest.InputData = inputData
|
||||
|
||||
// restore request body for any http.HandlerFunc below
|
||||
r.Body = io.NopCloser(bytes.NewReader(inputData))
|
||||
default:
|
||||
// Defensive.
|
||||
http.Error(w, "unsupported method for the actions API", http.StatusMethodNotAllowed)
|
||||
|
|
Loading…
Add table
Reference in a new issue