|
@@ -2,14 +2,11 @@ package http
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"bytes"
|
|
"bytes"
|
|
|
- "context"
|
|
|
|
|
json2 "encoding/json"
|
|
json2 "encoding/json"
|
|
|
"io/ioutil"
|
|
"io/ioutil"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
|
- context2 "git.ikuban.com/server/kratos-utils/http/context"
|
|
|
|
|
-
|
|
|
|
|
"google.golang.org/grpc/codes"
|
|
"google.golang.org/grpc/codes"
|
|
|
status2 "google.golang.org/grpc/status"
|
|
status2 "google.golang.org/grpc/status"
|
|
|
|
|
|
|
@@ -214,10 +211,7 @@ func contentSubtype(contentType string) string {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-func SetBody(ctx context.Context, r *http.Request) context.Context {
|
|
|
|
|
|
|
+func GetBody(r *http.Request) []byte {
|
|
|
b, _ := ioutil.ReadAll(r.Body)
|
|
b, _ := ioutil.ReadAll(r.Body)
|
|
|
- if len(b) > 0 {
|
|
|
|
|
- ctx = context2.AppendToContext(ctx, "body", string(b))
|
|
|
|
|
- }
|
|
|
|
|
- return ctx
|
|
|
|
|
|
|
+ return b
|
|
|
}
|
|
}
|