From 01afee95b0aa786398cae09393cbd3cf30dce51c Mon Sep 17 00:00:00 2001
From: Andrew Barba <barba@hey.com>
Date: Wed, 27 Nov 2024 16:54:17 -0500
Subject: [PATCH] Supress warning

---
 bun.lockb          | Bin 42394 -> 42719 bytes
 package.json       |   1 +
 src/apns.ts        |  10 ++++++++++
 test/apns2.test.ts |   1 +
 4 files changed, 12 insertions(+)

diff --git a/bun.lockb b/bun.lockb
index 535b14b34f420935c51b5bc43ba48d3b715ee072..67371fc92e46ff272cb2381e896327fb9ea041ce 100755
GIT binary patch
delta 2456
zcmeH}ZA@EL7{||Ti@Rk*=tfq`%L;`NaG|3N3Jf-IZ@5*4)j-2|akB#kw3Kd)K<3sm
zWfOxL@c6bRN@KK|$c*zwW3p_?l4-V(>2P8)XChnB7){uG`7%w^|8oK1gOY6Sn?A|!
z{GW54bIv{I+;i_aCq^}2U(yU%GoLKW9{j0l?TXO*w|bqwmUrd)KDzRmvZ~^d$sgsW
z-XWzTEL3Y7beT1F@2RdBtzoyXqoJ)+h!uz|79vPAs5KTwT7*bK?q-S*3D7T~Cg@pc
z95g(m$Dl^!yP?aWZsoc*S}PwoRXY?oFg~T+x^E;-pNBvUy4O+4l2tUYNS1ccadU|@
zOjnUkkSVz&A_E;1QIe%thbLE4U2;)G5MHI~jl*-QUV5q!6{@%YFYi3Oa<$BmCWM1M
zsg|lOMFu?{%CNEO=#0g<m2>w42}E-S#;OC$I0IWq;}OpST1rYa((~zY0q$uHU}KE{
z1z-u-1lU-$po}xHzf-KFs8^$Rqye?bT{OH$?XYdwcmT0fo?)cg4EbK5uIoOvZz1L@
zuOqgsYOEU21$f;L0)8Kd0Kd`0fXj~pwuO}Y=~HW|N^h^!)5uEspHRp5>`eXnDx+*@
zru=S|oAaJ!*jRZ!QGn-%9ZaJZ{Z_dD@8&!DTzJJ6_{{#RySb8g)%;z|%f$JAwVRdd
z%#M`O#wN#?r(e50(dm{wH3b)5F)x1MT6N;i?>5$i%%3#BzW3cX9vq!o|3m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is~d-^s?x?fY^D)|n1K{U~4onSjR`
z6YT=WG*(F^>8?Nwyh(sxWj0`A<?eGh1N)icH;NTz?O$oY9HJWr`r~mD(Zeqy&xaGS
zf38D+<H3^Zh9(DiLbkNGW>vs8z!SI=@I3DVyiRHWm+uE`ohgrV&}`MIVx|A0p`@l^
z$>uT-whz};<?dY!m!;;TyCGi8asG#k`5QPq|A$K?jJh{mrtvcGYM2DWmolo;XrHdr
zcHK@-bzK%yMxK{O<k_h%PnRY1D9<a`kvrcj*HbOh4fGsoDR~xnaoPouZlpIz%fmAZ
zT(Q*9)9P4LTInmnTfJ3<=!G+qS{L36FIm!*Xfw)D3_Dg%GkjSt)BpM{Vw~aXtL<$z
zRZzWemaL^mK9`fX7v7R~gFRp`*a!MiLWRD9e*qpOYygM6xfgTb@u@T!c)%3Eo7e%s
zo8DM39=HJqdpvM}1i*(VpJu#jSJI`5xpEH4%4JD>s^x%O&`^N{_Hq+mbGUsi++wgA
zEDDDz`zdk_UGux*_(!Dpk-#1V=&gSwIjZJcJ(^okQPluCTGfBhL~Wc9TT81;HdhNV
z?f&=!?%cj*v9f5a=GG>JuUAd9%Od&`aHeW$kz2>BPvbVeOt&aj>DD|Ne?|^v8qNvP
z+ev)e@p{+vyA2)n(fdpG=um9g<H7GcYHDeh;Y^L*cdj(f%O2>Re5#}VGBq1c<zX7#
oHd1V=!QUaoDgzUkNJ@=HTForm5yLDM%GvOanssWp|CyWC?^h8p<p2Nx

diff --git a/package.json b/package.json
index f7893f2..56a320c 100644
--- a/package.json
+++ b/package.json
@@ -36,6 +36,7 @@
     "@tsconfig/node20": "^20.1.4",
     "@types/node": "^22.10.0",
     "chai": "^5.1.2",
+    "dotenv": "^16.4.5",
     "typescript": "^5.7.2",
     "vitest": "^2.1.6"
   },
diff --git a/src/apns.ts b/src/apns.ts
index 560889f..59c0d7f 100644
--- a/src/apns.ts
+++ b/src/apns.ts
@@ -59,6 +59,7 @@ export class ApnsClient extends EventEmitter {
       maxConcurrentStreams: 100,
     })
     this._token = null
+    this._supressH2Warning()
   }
 
   sendMany(notifications: Notification[]) {
@@ -156,4 +157,13 @@ export class ApnsClient extends EventEmitter {
 
     return token
   }
+
+  private _supressH2Warning() {
+    process.once("warning", (warning: Error & { code?: string }) => {
+      if (warning.code === "UNDICI-H2") {
+        return
+      }
+      process.emit("warning", warning)
+    })
+  }
 }
diff --git a/test/apns2.test.ts b/test/apns2.test.ts
index c9bc34d..c6ee794 100644
--- a/test/apns2.test.ts
+++ b/test/apns2.test.ts
@@ -1,3 +1,4 @@
+import "dotenv/config"
 import { assert } from "chai"
 import { beforeAll, describe, it } from "vitest"
 import { ApnsClient, Errors, Notification, SilentNotification } from "../src"