@@ -11,7 +11,7 @@ import { validateData, ValidateFunction } from "./internal/validate";
1111import { getRequestWebStream } from "./body" ;
1212
1313/**
14- * Get query the params object from the request URL parsed with [unjs/ufo](https://ufo.unjs.io).
14+ * Get the query params object from the request URL parsed with [unjs/ufo](https://ufo.unjs.io).
1515 *
1616 * @example
1717 * export default defineEventHandler((event) => {
@@ -27,7 +27,7 @@ export function getQuery<
2727}
2828
2929/**
30- * Get the query param from the request URL parsed with [unjs/ufo](https://ufo.unjs.io) and validated with validate function.
30+ * Get the query params object from the request URL parsed with [unjs/ufo](https://ufo.unjs.io) and validated with validate function.
3131 *
3232 * You can use a simple function to validate the query object or a library like `zod` to define a schema.
3333 *
@@ -319,7 +319,7 @@ export function getRequestPath(event: H3Event): string {
319319}
320320
321321/**
322- * Generated the full incoming request URL using `getRequestProtocol`, `getRequestHost` and `event.path`.
322+ * Generate the full incoming request URL using `getRequestProtocol`, `getRequestHost` and `event.path`.
323323 *
324324 * If `xForwardedHost` is `true`, it will use the `x-forwarded-host` header if it exists.
325325 *
@@ -364,7 +364,9 @@ export function toWebRequest(event: H3Event) {
364364/**
365365 * Try to get the client IP address from the incoming request.
366366 *
367- * If `xForwardedFor` is `true`, it will use the `x-forwarded-for` header if it exists.
367+ * If `xForwardedFor` is `true`, it will use the `x-forwarded-for` header set by proxies if it exists.
368+ *
369+ * Note: Make sure that this header can be trusted (your application running behind a CDN or reverse proxy) before enabling.
368370 *
369371 * If IP cannot be determined, it will default to `undefined`.
370372 *
@@ -375,14 +377,7 @@ export function toWebRequest(event: H3Event) {
375377 */
376378export function getRequestIP (
377379 event : H3Event ,
378- opts : {
379- /**
380- * Use the X-Forwarded-For HTTP header set by proxies.
381- *
382- * Note: Make sure that this header can be trusted (your application running behind a CDN or reverse proxy) before enabling.
383- */
384- xForwardedFor ?: boolean ;
385- } = { } ,
380+ opts : { xForwardedFor ?: boolean } = { } ,
386381) : string | undefined {
387382 if ( event . context . clientAddress ) {
388383 return event . context . clientAddress ;
0 commit comments