From e1baddb7bfcdfa825d4106121e9d50cafecb8678 Mon Sep 17 00:00:00 2001 From: Sean T Canavan Date: Wed, 29 Sep 2021 17:13:06 -0500 Subject: [PATCH] fix issue with new client overriding set api key (#1305) if you call `sgMail.setClient()` _before_ you call `sgMail.setApiKey()` then everything is great. If you call them in the order that this test does you'll forever get `Unauthorized` 401 section with data.headers not including `Bearer Authorization <>` --- test/typescript/mail.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/typescript/mail.ts b/test/typescript/mail.ts index 681b29e9a..fb8199860 100644 --- a/test/typescript/mail.ts +++ b/test/typescript/mail.ts @@ -1,12 +1,12 @@ import { Client } from "@sendgrid/client"; import sgMail = require("@sendgrid/mail"); -// Test setApiKey() method -sgMail.setApiKey("MY_SENDGRID_API_KEY"); - // Test setClient() method sgMail.setClient(new Client()); +// Test setApiKey() method +sgMail.setApiKey("MY_SENDGRID_API_KEY"); + // Test setSubstitutionWrappers() method sgMail.setSubstitutionWrappers("{{", "}}") @@ -276,4 +276,4 @@ sgMail.send({ ipPoolName: 'sendgrid-ip-pool-name', mailSettings: {}, trackingSettings: {}, -}); \ No newline at end of file +});