Skip to content

Commit

Permalink
report module version (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
rokostik authored Feb 22, 2024
1 parent 3b13d8b commit e2989be
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (frc *Client) VerifyCaptchaResponse(ctx context.Context, captchaResponse st

req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-Api-Key", frc.APIKey)
req.Header.Set("X-Frc-Sdk", "friendly-captcha-go-sdk@0.2.0")
req.Header.Set("X-Frc-Sdk", fmt.Sprintf("friendly-captcha-go-sdk@%s", Version()))

resp, err := frc.HTTPClient.Do(req)
if err != nil {
Expand Down
12 changes: 12 additions & 0 deletions version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package friendlycaptcha

import (
"runtime/debug"
)

func Version() string {
if bi, ok := debug.ReadBuildInfo(); ok {
return bi.Main.Version
}
return "unknown"
}

0 comments on commit e2989be

Please sign in to comment.