This commit is contained in:
Shreyas Goenka 2025-02-05 15:03:27 +01:00
parent 5a1f36e07d
commit 61b2e22f5e
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
6 changed files with 64 additions and 6 deletions

View File

@ -35,7 +35,7 @@ var (
// In order to debug CLI running under acceptance test, set this to full subtest name, e.g. "bundle/variables/empty"
// Then install your breakpoints and click "debug test" near TestAccept in VSCODE.
// example: var SingleTest = "bundle/variables/empty"
var SingleTest = ""
var SingleTest = "auth/basic"
// If enabled, instead of compiling and running CLI externally, we'll start in-process server that accepts and runs
// CLI commands. The $CLI in test scripts is a helper that just forwards command-line arguments to this server (see bin/callserver.py).

View File

@ -1 +1 @@
{"method":"GET","path":"/api/2.0/preview/scim/v2/Me","headers":{"Authorization":"Basic dXNlcm5hbWU6cGFzc3dvcmQ=","User-Agent":"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID] auth/basic"},"body":""}
{"headers":{"Authorization":"Basic dXNlcm5hbWU6cGFzc3dvcmQ=","User-Agent":"cli/[DEV_VERSION] databricks-sdk-go/[SDK_VERSION] go/[GO_VERSION] os/[OS] cmd/current-user_me cmd-exec-id/[UUID] auth/basic"},"method":"GET","path":"/api/2.0/preview/scim/v2/Me","body":""}

View File

@ -1,4 +1,20 @@
LocalOnly = true
RecordRequests = true
IncludeReqHeaders = ["Authorization", "User-Agent"]
IncludeRequestHeaders = ["Authorization", "User-Agent"]
[[Repls]]
Old = '(linux|darwin|windows)'
New = '[OS]'
[[Repls]]
Old = " upstream/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " upstream-version/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " cicd/[A-Za-z0-9.-]+"
New = ""

View File

@ -1,4 +1,20 @@
LocalOnly = true
RecordRequests = true
IncludeReqHeaders = ["Authorization", "User-Agent"]
IncludeRequestHeaders = ["Authorization", "User-Agent"]
[[Repls]]
Old = '(linux|darwin|windows)'
New = '[OS]'
[[Repls]]
Old = " upstream/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " upstream-version/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " cicd/[A-Za-z0-9.-]+"
New = ""

View File

@ -1,4 +1,20 @@
LocalOnly = true
RecordRequests = true
IncludeReqHeaders = ["Authorization", "User-Agent"]
IncludeRequestHeaders = ["Authorization", "User-Agent"]
[[Repls]]
Old = '(linux|darwin|windows)'
New = '[OS]'
[[Repls]]
Old = " upstream/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " upstream-version/[A-Za-z0-9.-]+"
New = ""
[[Repls]]
Old = " cicd/[A-Za-z0-9.-]+"
New = ""

View File

@ -61,11 +61,21 @@ func (s *Server) Handle(pattern string, handler HandlerFunc) {
headers[k] = v[0]
}
var reqBody any
if json.Valid(body) {
// If the request body is a valid JSON, typecast it to json.RawMessage.
// This way json.Marshal will ignore the body and serialize it
// as is, which is what we want because the body is already a JSON.
reqBody = json.RawMessage(body)
} else {
reqBody = body
}
s.Requests = append(s.Requests, Request{
Headers: headers,
Method: r.Method,
Path: r.URL.Path,
Body: json.RawMessage(body),
Body: reqBody,
})
}