From be1b76e954adb6d8aedba37d3820f125e0f5603d Mon Sep 17 00:00:00 2001 From: Patrick Crane Date: Fri, 19 Nov 2021 14:50:41 -0500 Subject: [PATCH] Weight input as integer --- client.go | 4 ++-- email.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client.go b/client.go index c3ed86e..2a714c8 100644 --- a/client.go +++ b/client.go @@ -129,8 +129,8 @@ func (c *client) makeEmailRequest(ctx context.Context, e *Email) *resty.Request if e.options.flag != 0 { headers["Flag"] = fmt.Sprintf("%d", e.options.flag) } - if e.options.weight != 0.0 { - headers["Weight"] = fmt.Sprintf("%f", e.options.weight) + if e.options.weight != 0 { + headers["Weight"] = fmt.Sprintf("%d", e.options.weight) } return c.client.R(). SetContext(ctx). diff --git a/email.go b/email.go index 7fe5c82..17a800b 100644 --- a/email.go +++ b/email.go @@ -15,7 +15,7 @@ type Email struct { // Options encapsulate headers the client can pass in requests to rspamd. type Options struct { flag int - weight float64 + weight int32 } // SymbolData encapsulates the data returned for each symbol from Check. @@ -58,7 +58,7 @@ func (e *Email) Flag(flag int) *Email { // Weight attaches a weight to an Email, and eventually as a header when sent to rspamd. // Weight is added to hashes. -func (e *Email) Weight(weight float64) *Email { +func (e *Email) Weight(weight int32) *Email { e.options.weight = weight return e }