Skip to content

Commit

Permalink
fix: remove use of deprecated getRequestPath util
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Apr 29, 2024
1 parent 75a74ea commit 50c5d7d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/runtime/nitro.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { NitroAppPlugin, RenderResponse } from 'nitropack'
import { getRequestPath } from 'h3'
import { useChecker, getValidator, isIgnored } from './validator'
// @ts-expect-error virtual module
import config from '#html-validator-config'
Expand All @@ -11,7 +10,7 @@ export default <NitroAppPlugin> function (nitro) {
nitro.hooks.hook('render:response', async (response: Partial<RenderResponse>, { event }) => {
if (typeof response.body === 'string' && (response.headers?.['Content-Type'] || response.headers?.['content-type'])?.includes('html') && !isIgnored(event.path, config.ignore)) {
// Block the response only if it's not hookable
const promise = checkHTML(getRequestPath(event), response.body)
const promise = checkHTML(event.path, response.body)
if (config.hookable) {
await nitro.hooks.callHook('html-validator:check', await promise, response, { event })
}
Expand Down

0 comments on commit 50c5d7d

Please sign in to comment.