mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DS apiserver: Minor fixes (#84691)
This commit is contained in:
parent
58170d4141
commit
e978d0810e
@ -69,6 +69,7 @@ func (r *subQueryREST) Connect(ctx context.Context, name string, opts runtime.Ob
|
||||
}
|
||||
if dsRef != nil && dsRef.UID != name {
|
||||
responder.Error(fmt.Errorf("expected query body datasource and request to match"))
|
||||
return
|
||||
}
|
||||
|
||||
ctx = backend.WithGrafanaConfig(ctx, pluginCtx.GrafanaConfig)
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@ -66,12 +67,21 @@ func (r *subResourceREST) Connect(ctx context.Context, name string, opts runtime
|
||||
return
|
||||
}
|
||||
|
||||
path := req.URL.Path[idx+len("/resource"):]
|
||||
clonedReq := req.Clone(req.Context())
|
||||
rawURL := req.URL.Path[idx+len("/resource"):]
|
||||
|
||||
clonedReq.URL = &url.URL{
|
||||
Path: rawURL,
|
||||
RawQuery: clonedReq.URL.RawQuery,
|
||||
}
|
||||
|
||||
err = r.builder.client.CallResource(ctx, &backend.CallResourceRequest{
|
||||
PluginContext: pluginCtx,
|
||||
Path: path,
|
||||
Path: clonedReq.URL.Path,
|
||||
Method: req.Method,
|
||||
URL: req.URL.String(),
|
||||
Body: body,
|
||||
Headers: req.Header,
|
||||
}, httpresponsesender.New(w))
|
||||
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user