Skip to content

Commit

Permalink
chore: use getRequestHeaders instead of alias
Browse files Browse the repository at this point in the history
  • Loading branch information
Yizack committed Jun 30, 2024
1 parent 08ea51b commit d3c670c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/runtime/server/lib/validators/github.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { subtle } from 'node:crypto'
import { Buffer } from 'node:buffer'
import { type H3Event, getHeaders, readRawBody } from 'h3'
import { type H3Event, getRequestHeaders, readRawBody } from 'h3'
import { useRuntimeConfig } from '#imports'

/**
Expand All @@ -11,7 +11,7 @@ import { useRuntimeConfig } from '#imports'
* @returns {boolean} `true` if the webhook is valid, `false` otherwise
*/
export const isValidGithubWebhook = async (event: H3Event): Promise<boolean> => {
const headers = getHeaders(event)
const headers = getRequestHeaders(event)
const body = await readRawBody(event)
const { secretKey } = useRuntimeConfig(event).webhook.github

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/lib/validators/paddle.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { subtle } from 'node:crypto'
import { Buffer } from 'node:buffer'
import { type H3Event, getHeaders, readRawBody } from 'h3'
import { type H3Event, getRequestHeaders, readRawBody } from 'h3'
import { useRuntimeConfig } from '#imports'

const MAX_VALID_TIME_DIFFERENCE = 5
Expand Down Expand Up @@ -28,7 +28,7 @@ const extractHeaders = (header: string) => {
* @returns {boolean} `true` if the webhook is valid, `false` otherwise
*/
export const isValidPaddleWebhook = async (event: H3Event): Promise<boolean> => {
const headers = getHeaders(event)
const headers = getRequestHeaders(event)
const body = await readRawBody(event)
const { webhookId } = useRuntimeConfig(event).webhook.paddle

Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/lib/validators/paypal.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { type H3Event, getHeaders, readBody } from 'h3'
import { type H3Event, getRequestHeaders, readBody } from 'h3'
import { useRuntimeConfig } from '#imports'

const baseAPI = import.meta.dev ? 'https://api-m.sandbox.paypal.com/v1' : 'https://api-m.paypal.com/v1'
Expand All @@ -11,7 +11,7 @@ const baseAPI = import.meta.dev ? 'https://api-m.sandbox.paypal.com/v1' : 'https
* @returns {boolean} `true` if the webhook is valid, `false` otherwise
*/
export const isValidPaypalWebhook = async (event: H3Event): Promise<boolean> => {
const headers = getHeaders(event)
const headers = getRequestHeaders(event)
const body = await readBody(event)

if (!body || !headers) return false
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/server/lib/validators/twitch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { subtle } from 'node:crypto'
import { Buffer } from 'node:buffer'
import { type H3Event, getHeaders, readRawBody } from 'h3'
import { type H3Event, getRequestHeaders, readRawBody } from 'h3'
import { useRuntimeConfig } from '#imports'

/**
Expand All @@ -11,7 +11,7 @@ import { useRuntimeConfig } from '#imports'
* @returns {boolean} `true` if the webhook is valid, `false` otherwise
*/
export const isValidTwitchWebhook = async (event: H3Event): Promise<boolean> => {
const headers = getHeaders(event)
const headers = getRequestHeaders(event)
const body = await readRawBody(event)
const { secretKey } = useRuntimeConfig(event).webhook.twitch

Expand Down

0 comments on commit d3c670c

Please sign in to comment.