Skip to content

Commit 5ee0ee9

Browse files
committed
Fix v2 pkpass API
1 parent 80db2c9 commit 5ee0ee9

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/api/routes/v2/mobileWallet.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import jwt, { Algorithm } from "jsonwebtoken";
1515
import { getJwksKey } from "api/plugins/auth.js";
1616
import { issueAppleWalletMembershipCard } from "api/functions/mobileWallet.js";
1717
import { Redis } from "api/types.js";
18+
import { Readable } from "stream";
1819

1920
const UIUC_TENANT_ID = "44467e6f-462c-4ea2-823f-7800de5434e3";
2021
const COULD_NOT_PARSE_MESSAGE = "ID token could not be parsed.";
@@ -169,9 +170,14 @@ const mobileWalletV2Route: FastifyPluginAsync = async (fastify, _options) => {
169170
request.log,
170171
name,
171172
);
172-
await reply
173-
.header("Content-Type", "application/vnd.apple.pkpass")
174-
.send(pkpass);
173+
const myStream = new Readable({
174+
read() {
175+
this.push(pkpass);
176+
this.push(null);
177+
},
178+
});
179+
180+
await reply.type("application/vnd.apple.pkpass").send(myStream);
175181
},
176182
);
177183
};

0 commit comments

Comments
 (0)