diff --git a/pkg/apis/logging/v1alpha2/register.go b/pkg/apis/logging/v1alpha2/register.go index 8e89b4632d082fe7794c22380574870c71b037ab..fa4b59d849de9ad473059e93b98084a07041276b 100644 --- a/pkg/apis/logging/v1alpha2/register.go +++ b/pkg/apis/logging/v1alpha2/register.go @@ -69,7 +69,7 @@ func addWebService(c *restful.Container) error { Writes(v1alpha2.QueryResult{}). Returns(http.StatusOK, RespOK, v1alpha2.QueryResult{})). Consumes(restful.MIME_JSON, restful.MIME_XML). - Produces(restful.MIME_JSON, restful.MIME_OCTET) + Produces(restful.MIME_JSON, "text/plain") ws.Route(ws.GET("/workspaces/{workspace}").To(logging.LoggingQueryWorkspace). Doc("Query logs against the specific workspace."). diff --git a/pkg/apis/tenant/v1alpha2/register.go b/pkg/apis/tenant/v1alpha2/register.go index df75d8b8de0faa9a41ac7db65d9e385a09d96122..f4a916e1700d3bb6fedd0d4e253e016a4a4d67ef 100644 --- a/pkg/apis/tenant/v1alpha2/register.go +++ b/pkg/apis/tenant/v1alpha2/register.go @@ -179,7 +179,7 @@ func addWebService(c *restful.Container) error { Writes(v1alpha2.Response{}). Returns(http.StatusOK, RespOK, v1alpha2.Response{})). Consumes(restful.MIME_JSON, restful.MIME_XML). - Produces(restful.MIME_JSON, restful.MIME_OCTET) + Produces(restful.MIME_JSON, "text/plain") c.Add(ws) return nil diff --git a/pkg/apiserver/logging/logging.go b/pkg/apiserver/logging/logging.go index f824adbea1275f853b9f09176124189126418f6f..39a73e608575bad580b7a706b8f3427f1a127ded 100644 --- a/pkg/apiserver/logging/logging.go +++ b/pkg/apiserver/logging/logging.go @@ -162,7 +162,8 @@ func logExport(param v1alpha2.QueryParameters, request *restful.Request, respons return } - response.Header().Set("Content-Type", restful.MIME_OCTET) + response.Header().Set(restful.HEADER_ContentType, "text/plain") + response.Header().Set("Content-Disposition", "attachment") // keep search context alive for 1m param.ScrollTimeout = time.Minute diff --git a/pkg/apiserver/tenant/tenant.go b/pkg/apiserver/tenant/tenant.go index 205e9219911d919c80929eaf92473d846005dde5..d0f6a35b293d59394ef1c04b2d0bdfc8eebdf1a2 100644 --- a/pkg/apiserver/tenant/tenant.go +++ b/pkg/apiserver/tenant/tenant.go @@ -348,7 +348,8 @@ func LogQuery(req *restful.Request, resp *restful.Response) { logging.LoggingQueryCluster(req, resp) default: if operation == "export" { - resp.Header().Set("Content-Type", restful.MIME_OCTET) + resp.Header().Set(restful.HEADER_ContentType, "text/plain") + resp.Header().Set("Content-Disposition", "attachment") resp.Write(nil) } else { resp.WriteAsJson(loggingv1alpha2.QueryResult{Read: new(loggingv1alpha2.ReadResult)})