|
@@ -1,6 +1,7 @@
|
|
|
package http
|
|
package http
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "fmt"
|
|
|
"net/http"
|
|
"net/http"
|
|
|
"strings"
|
|
"strings"
|
|
|
|
|
|
|
@@ -8,6 +9,10 @@ import (
|
|
|
|
|
|
|
|
"github.com/go-kratos/kratos/v2/encoding/json"
|
|
"github.com/go-kratos/kratos/v2/encoding/json"
|
|
|
"google.golang.org/grpc/encoding"
|
|
"google.golang.org/grpc/encoding"
|
|
|
|
|
+
|
|
|
|
|
+ // init encoding
|
|
|
|
|
+ _ "google.golang.org/grpc/encoding/gzip"
|
|
|
|
|
+ _ "google.golang.org/grpc/encoding/proto"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func ErrHandle(w http.ResponseWriter, r *http.Request, err error) {
|
|
func ErrHandle(w http.ResponseWriter, r *http.Request, err error) {
|
|
@@ -46,7 +51,9 @@ func codecForRequest(r *http.Request) encoding.Codec {
|
|
|
}
|
|
}
|
|
|
if codec == nil {
|
|
if codec == nil {
|
|
|
codec = encoding.GetCodec(json.Name)
|
|
codec = encoding.GetCodec(json.Name)
|
|
|
|
|
+ fmt.Println(codec == nil)
|
|
|
}
|
|
}
|
|
|
|
|
+ fmt.Println(codec == nil)
|
|
|
return codec
|
|
return codec
|
|
|
}
|
|
}
|
|
|
|
|
|