From 69bd498b6527b63f9429b85276ebecbd9ba46250 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 14 Aug 2023 18:49:57 +0000 Subject: [PATCH] Bump github.com/sendgrid/sendgrid-go in /src Bumps [github.com/sendgrid/sendgrid-go](https://github.com/sendgrid/sendgrid-go) from 3.12.0+incompatible to 3.13.0+incompatible. - [Release notes](https://github.com/sendgrid/sendgrid-go/releases) - [Changelog](https://github.com/sendgrid/sendgrid-go/blob/main/CHANGELOG.md) - [Commits](https://github.com/sendgrid/sendgrid-go/compare/v3.12.0...v3.13.0) --- updated-dependencies: - dependency-name: github.com/sendgrid/sendgrid-go dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- src/go.mod | 2 +- src/go.sum | 4 ++-- .../sendgrid/sendgrid-go/CHANGELOG.md | 6 +++++ .../github.com/sendgrid/sendgrid-go/LICENSE | 2 +- .../sendgrid/sendgrid-go/base_interface.go | 22 ++++++++++++++++++- src/vendor/modules.txt | 2 +- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/go.mod b/src/go.mod index fb6781d..126926b 100644 --- a/src/go.mod +++ b/src/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/golang/glog v1.1.1 github.com/r3labs/diff/v3 v3.0.1 - github.com/sendgrid/sendgrid-go v3.12.0+incompatible + github.com/sendgrid/sendgrid-go v3.13.0+incompatible github.com/stretchr/testify v1.8.3 ) diff --git a/src/go.sum b/src/go.sum index f927636..d5b86b2 100644 --- a/src/go.sum +++ b/src/go.sum @@ -9,8 +9,8 @@ github.com/r3labs/diff/v3 v3.0.1 h1:CBKqf3XmNRHXKmdU7mZP1w7TV0pDyVCis1AUHtA4Xtg= github.com/r3labs/diff/v3 v3.0.1/go.mod h1:f1S9bourRbiM66NskseyUdo0fTmEE0qKrikYJX63dgo= github.com/sendgrid/rest v2.6.9+incompatible h1:1EyIcsNdn9KIisLW50MKwmSRSK+ekueiEMJ7NEoxJo0= github.com/sendgrid/rest v2.6.9+incompatible/go.mod h1:kXX7q3jZtJXK5c5qK83bSGMdV6tsOE70KbHoqJls4lE= -github.com/sendgrid/sendgrid-go v3.12.0+incompatible h1:/N2vx18Fg1KmQOh6zESc5FJB8pYwt5QFBDflYPh1KVg= -github.com/sendgrid/sendgrid-go v3.12.0+incompatible/go.mod h1:QRQt+LX/NmgVEvmdRw0VT/QgUn499+iza2FnDca9fg8= +github.com/sendgrid/sendgrid-go v3.13.0+incompatible h1:HZrzc06/QfBGesY9o3n1lvBrRONA+57rbDRKet7plos= +github.com/sendgrid/sendgrid-go v3.13.0+incompatible/go.mod h1:QRQt+LX/NmgVEvmdRw0VT/QgUn499+iza2FnDca9fg8= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= diff --git a/src/vendor/github.com/sendgrid/sendgrid-go/CHANGELOG.md b/src/vendor/github.com/sendgrid/sendgrid-go/CHANGELOG.md index e28d128..db8a219 100644 --- a/src/vendor/github.com/sendgrid/sendgrid-go/CHANGELOG.md +++ b/src/vendor/github.com/sendgrid/sendgrid-go/CHANGELOG.md @@ -1,6 +1,12 @@ # Change Log All notable changes to this project will be documented in this file. +[2023-08-10] Version 3.13.0 +--------------------------- +**Library - Feature** +- [PR #468](https://github.com/sendgrid/sendgrid-go/pull/468): gzip mail body when content-encoding is set to gzip. Thanks to [@Bankq](https://github.com/Bankq)! + + [2022-09-21] Version 3.12.0 --------------------------- **Library - Feature** diff --git a/src/vendor/github.com/sendgrid/sendgrid-go/LICENSE b/src/vendor/github.com/sendgrid/sendgrid-go/LICENSE index 5db04ff..3154774 100644 --- a/src/vendor/github.com/sendgrid/sendgrid-go/LICENSE +++ b/src/vendor/github.com/sendgrid/sendgrid-go/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (C) 2022, Twilio SendGrid, Inc. +Copyright (C) 2023, Twilio SendGrid, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in diff --git a/src/vendor/github.com/sendgrid/sendgrid-go/base_interface.go b/src/vendor/github.com/sendgrid/sendgrid-go/base_interface.go index 60c04bd..ae82681 100644 --- a/src/vendor/github.com/sendgrid/sendgrid-go/base_interface.go +++ b/src/vendor/github.com/sendgrid/sendgrid-go/base_interface.go @@ -1,6 +1,8 @@ package sendgrid import ( + "bytes" + "compress/gzip" "context" "errors" "net/http" @@ -13,7 +15,7 @@ import ( // Version is this client library's current version const ( - Version = "3.12.0" + Version = "3.13.0" rateLimitRetry = 5 rateLimitSleep = 1100 ) @@ -61,6 +63,24 @@ func (cl *Client) Send(email *mail.SGMailV3) (*rest.Response, error) { // SendWithContext sends an email through Twilio SendGrid with context.Context. func (cl *Client) SendWithContext(ctx context.Context, email *mail.SGMailV3) (*rest.Response, error) { cl.Body = mail.GetRequestBody(email) + // when Content-Encoding header is set to "gzip" + // mail body is compressed using gzip according to + // https://docs.sendgrid.com/api-reference/mail-send/mail-send#mail-body-compression + if cl.Headers["Content-Encoding"] == "gzip" { + var gzipped bytes.Buffer + gz := gzip.NewWriter(&gzipped) + if _, err := gz.Write(cl.Body); err != nil { + return nil, err + } + if err := gz.Flush(); err != nil { + return nil, err + } + if err := gz.Close(); err != nil { + return nil, err + } + + cl.Body = gzipped.Bytes() + } return MakeRequestWithContext(ctx, cl.Request) } diff --git a/src/vendor/modules.txt b/src/vendor/modules.txt index 9f167e6..2bca960 100644 --- a/src/vendor/modules.txt +++ b/src/vendor/modules.txt @@ -15,7 +15,7 @@ github.com/r3labs/diff/v3 # github.com/sendgrid/rest v2.6.9+incompatible ## explicit github.com/sendgrid/rest -# github.com/sendgrid/sendgrid-go v3.12.0+incompatible +# github.com/sendgrid/sendgrid-go v3.13.0+incompatible ## explicit github.com/sendgrid/sendgrid-go github.com/sendgrid/sendgrid-go/helpers/mail