[proxy] refactoring out common marshalling logic

This commit is contained in:
Paul Bellamy authored and Matthias Radestock committed 2015-09-04 13:40:07 +01:00
1 parent e21a204eed
commit 19ceb424c3
5 files changed
+46 -65

No files matched your search

+1 -11
View File
@@ -1,9 +1,6 @@
package proxy
import (
"bytes"
"encoding/json"
"io/ioutil"
"net/http"
"strings"
@@ -14,15 +11,8 @@ import (
type createExecInterceptor struct{ proxy *Proxy }
func (i *createExecInterceptor) InterceptRequest(r *http.Request) error {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
return err
}
r.Body.Close()
r.Body = ioutil.NopCloser(bytes.NewReader(body))
options := docker.CreateExecOptions{}
if err := json.Unmarshal(body, &options); err != nil {
if err := unmarshalRequestBody(r, &options); err != nil {
return err
}