Skip to content

Commit

Permalink
VW: update api (#2) (#19500)
Browse files Browse the repository at this point in the history
  • Loading branch information
andig authored Mar 6, 2025
1 parent 6aac2dc commit ec6fead
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion vehicle/vag/vwidentity/forms.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func parseCredentials(body string) (CredentialParams, error) {

// clean quotes
quotes1 := strings.ReplaceAll(match[0][1], `'`, `"`)
quotes2 := regexp.MustCompile(`\s(\w+)(?s)*:`).ReplaceAllString(quotes1, `" $1":`)
quotes2 := regexp.MustCompile(`\s(\w+)(?s)*:`).ReplaceAllString(quotes1, ` "$1":`)

// strip , }
tmpl := regexp.MustCompile(`(?s),\s+}`).ReplaceAllString(quotes2, "}")
Expand Down
4 changes: 3 additions & 1 deletion vehicle/vag/vwidentity/forms_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ func TestParse(t *testing.T) {
}
</script>`

_, err := parseCredentials(b)
res, err := parseCredentials(b)
require.NoError(t, err)
require.Equal(t, "16563a265369fbc1ef1ba126411349a430b1d8b5c1592b6284216dc634169ca3", res.TemplateModel.Hmac)
require.Equal(t, "pwAX6CTKoSQWsej-9sROQ5LPw8Qy0gCT9oSdFxFxo9VkyNeYxjMg2kevkhY70Iyawul6e_D27qYK5za-leCoJXMSxu1R8eep", res.CsrfToken)
}

0 comments on commit ec6fead

Please sign in to comment.