mirror of https://github.com/milvus-io/milvus.git
fix: set proxy.http.acceptTypeAllowInt64: true as default (#30720)
issue: #30680 also let the parameter item to be refreshable Signed-off-by: PowderLi <min.li@zilliz.com>pull/30372/head
parent
3775464b7c
commit
50a78b682e
|
@ -91,8 +91,7 @@ func initHTTPServer(proxy types.ProxyComponent, needAuth bool) *gin.Engine {
|
|||
ginHandler.Use(func(c *gin.Context) {
|
||||
_, err := strconv.ParseBool(c.Request.Header.Get(HTTPHeaderAllowInt64))
|
||||
if err != nil {
|
||||
httpParams := ¶mtable.Get().HTTPCfg
|
||||
if httpParams.AcceptTypeAllowInt64.GetAsBool() {
|
||||
if paramtable.Get().HTTPCfg.AcceptTypeAllowInt64.GetAsBool() {
|
||||
c.Request.Header.Set(HTTPHeaderAllowInt64, "true")
|
||||
} else {
|
||||
c.Request.Header.Set(HTTPHeaderAllowInt64, "false")
|
||||
|
|
|
@ -193,15 +193,14 @@ func (s *Server) startHTTPServer(errChan chan error) {
|
|||
},
|
||||
})
|
||||
ginHandler.Use(ginLogger, gin.Recovery())
|
||||
httpHeaderAllowInt64 := "false"
|
||||
httpParams := ¶mtable.Get().HTTPCfg
|
||||
if httpParams.AcceptTypeAllowInt64.GetAsBool() {
|
||||
httpHeaderAllowInt64 = "true"
|
||||
}
|
||||
ginHandler.Use(func(c *gin.Context) {
|
||||
_, err := strconv.ParseBool(c.Request.Header.Get(httpserver.HTTPHeaderAllowInt64))
|
||||
if err != nil {
|
||||
c.Request.Header.Set(httpserver.HTTPHeaderAllowInt64, httpHeaderAllowInt64)
|
||||
if paramtable.Get().HTTPCfg.AcceptTypeAllowInt64.GetAsBool() {
|
||||
c.Request.Header.Set(httpserver.HTTPHeaderAllowInt64, "true")
|
||||
} else {
|
||||
c.Request.Header.Set(httpserver.HTTPHeaderAllowInt64, "false")
|
||||
}
|
||||
}
|
||||
c.Writer.Header().Set("Access-Control-Allow-Origin", "*")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
|
|
|
@ -4,7 +4,7 @@ type httpConfig struct {
|
|||
Enabled ParamItem `refreshable:"false"`
|
||||
DebugMode ParamItem `refreshable:"false"`
|
||||
Port ParamItem `refreshable:"false"`
|
||||
AcceptTypeAllowInt64 ParamItem `refreshable:"false"`
|
||||
AcceptTypeAllowInt64 ParamItem `refreshable:"true"`
|
||||
EnablePprof ParamItem `refreshable:"false"`
|
||||
RequestTimeoutMs ParamItem `refreshable:"false"`
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func (p *httpConfig) init(base *BaseTable) {
|
|||
|
||||
p.AcceptTypeAllowInt64 = ParamItem{
|
||||
Key: "proxy.http.acceptTypeAllowInt64",
|
||||
DefaultValue: "false",
|
||||
DefaultValue: "true",
|
||||
Version: "2.3.2",
|
||||
Doc: "high-level restful api, whether http client can deal with int64",
|
||||
PanicIfEmpty: false,
|
||||
|
|
|
@ -13,6 +13,6 @@ func TestHTTPConfig_Init(t *testing.T) {
|
|||
assert.Equal(t, cfg.Enabled.GetAsBool(), true)
|
||||
assert.Equal(t, cfg.DebugMode.GetAsBool(), false)
|
||||
assert.Equal(t, cfg.Port.GetValue(), "")
|
||||
assert.Equal(t, cfg.AcceptTypeAllowInt64.GetValue(), "false")
|
||||
assert.Equal(t, cfg.AcceptTypeAllowInt64.GetValue(), "true")
|
||||
assert.Equal(t, cfg.EnablePprof.GetAsBool(), true)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue