fix(02-03): capture OAuth code from JSON redirect URLs
Consent returns the callback URL in JSON, so replay can fill {{oauth:code}} from $.data.redirect_to before the token request.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -249,6 +249,21 @@ func extractCapture(rule CaptureRule, req Request, resp Response) (string, error
|
||||
return "", err
|
||||
}
|
||||
return scalarString(v), nil
|
||||
case "response.json.query":
|
||||
v, err := jsonPathValue([]byte(resp.Body), rule.Path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
raw := scalarString(v)
|
||||
u, err := url.Parse(raw)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
q := u.Query().Get(rule.Name)
|
||||
if q == "" {
|
||||
return "", fmt.Errorf("missing JSON URL query %s", rule.Name)
|
||||
}
|
||||
return q, nil
|
||||
case "response.header":
|
||||
v := headerValue(resp.Headers, rule.Name)
|
||||
if v == "" {
|
||||
|
||||
Reference in New Issue
Block a user