Skip to content

Instantly share code, notes, and snippets.

View JavascriptMick's full-sized avatar

JavascriptMick JavascriptMick

View GitHub Profile
@JavascriptMick
JavascriptMick / myapimethod.post.ts
Created September 11, 2024 16:52
Accept gzipped json POST request in Nuxt3/H3
import { H3Event, readBody, eventHandler } from 'h3';
import { createGunzip } from 'zlib';
import { pipeline } from 'stream';
import { promisify } from 'util';
const pipelineAsync = promisify(pipeline);
export default eventHandler(async (event: H3Event) => {
let rawBody = '{}';
if (event.headers.get('content-encoding') === 'gzip') {
const { req } = event; // deprecated but it works... open to suggestion, readBody fails
@JavascriptMick
JavascriptMick / README.md
Last active January 19, 2025 15:43
RevenueCat Rest API V2 with Typescript