@@ -522,6 +522,15 @@ func (h HTTPFetcher) DumpClusterHeap(role string) ([]byte, error) {
522522 return result , nil
523523}
524524
525+ // GetClusterConfig returns the cluster operational config.
526+ func (h HTTPFetcher ) GetClusterConfig () ([]byte , error ) {
527+ result , err := httpGetRequest (h , "/getClusterConfig" )
528+ if err != nil {
529+ return constants .EmptyByte , utils .GetError ("cannot get cluster config" , err )
530+ }
531+ return result , nil
532+ }
533+
525534// ConfigureTracing instructs the cluster to configure tracing for the role or all members
526535func (h HTTPFetcher ) ConfigureTracing (role string , tracingRatio float32 ) ([]byte , error ) {
527536 var (
@@ -1102,6 +1111,7 @@ func httpRequest(h HTTPFetcher, requestType, urlAppend string, absolute bool, co
11021111 URL = url.URL {}
11031112 httpProxy = os .Getenv ("HTTP_PROXY" )
11041113 proxy * url.URL
1114+ isJSON = true
11051115 )
11061116
11071117 // if the username and password was sent in then use it
@@ -1187,6 +1197,12 @@ func httpRequest(h HTTPFetcher, requestType, urlAppend string, absolute bool, co
11871197 req .Header .Set ("Content-Type" , "application/json" )
11881198 }
11891199
1200+ // special case for getClusterConfig
1201+ if strings .Contains (urlAppend , "getClusterConfig" ) {
1202+ isJSON = false
1203+ req .Header .Set ("Content-Type" , "application/xml" )
1204+ }
1205+
11901206 resp , err = client .Do (req )
11911207 if err != nil {
11921208 return empty , err
@@ -1216,7 +1232,7 @@ func httpRequest(h HTTPFetcher, requestType, urlAppend string, absolute bool, co
12161232 }
12171233
12181234 body = buffer .Bytes ()
1219- if len (body ) > 0 && ! isValidJSON (body ) {
1235+ if len (body ) > 0 && isJSON && ! isValidJSON (body ) {
12201236 return empty , errors .New ("invalid JSON body" )
12211237 }
12221238
0 commit comments