diff --git a/component/remote/async.go b/component/remote/async.go index 623e696..2fb8512 100644 --- a/component/remote/async.go +++ b/component/remote/async.go @@ -175,7 +175,12 @@ func createApolloConfigWithJSON(b []byte, callback http.CallBack) (o interface{} if parser == nil { return apolloConfig, nil } - m, err := parser.Parse(apolloConfig.Configurations[defaultContentKey]) + + content, ok := apolloConfig.Configurations[defaultContentKey] + if !ok { + content = string(b) + } + m, err := parser.Parse(content) if err != nil { log.Debugf("GetContent fail ! error: %v", err) } diff --git a/component/remote/sync.go b/component/remote/sync.go index 8153587..ea51487 100644 --- a/component/remote/sync.go +++ b/component/remote/sync.go @@ -83,7 +83,12 @@ func processJSONFiles(b []byte, callback http.CallBack) (o interface{}, err erro if parser == nil { return apolloConfig, nil } - m, err := parser.Parse(configurations[defaultContentKey]) + + content, ok := configurations[defaultContentKey] + if !ok { + content = string(b) + } + m, err := parser.Parse(content) if err != nil { log.Debugf("GetContent fail ! error: %v", err) }