Skip to content

Commit 0043eef

Browse files
fix: template cookie
1 parent d8e01bf commit 0043eef

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

definitions/vite-supadata-runner/worker/userRoutes.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
import { Hono } from "hono";
2-
import {
3-
getCookie,
4-
} from 'hono/cookie'
52
import {
63
Crawl,
74
CrawlJob,
@@ -15,14 +12,13 @@ import {
1512
YoutubePlaylist,
1613
YoutubeVideo,
1714
} from '@supadata/js';
18-
import { API_RESPONSES } from './config';
1915

20-
async function getUserAPIKey(request: any) {
16+
async function getUserAPIKey(c: any) {
2117
const res = await fetch(`https://dash.supadata.ai/api/get-api-key`, {
2218
headers: {
2319
'Content-Type': 'application/json',
2420
// If this API is called in the Cloudflare Worker, Cookie need to be passed.
25-
'Cookie': getCookie(request)
21+
'Cookie': c.req.header('Cookie')
2622
}
2723
})
2824

@@ -40,7 +36,7 @@ export function userRoutes(app: Hono<{ Bindings: any }>) {
4036
app.post('/api/supadata/transcript', async (c) => {
4137
let apiKey = ''
4238
let e = {} as any
43-
const cookie = getCookie(c)
39+
const cookie = c.req.header('Cookie')
4440
try {
4541
// GET API KEY BY THIS METHOD. DO NOT GET API KEY FROM ENV.
4642
apiKey = await getUserAPIKey(c);

0 commit comments

Comments
 (0)