new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Nuxt · API · all subjects

composables/use-request-url

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

useRequestURL minimum version

useRequestURL is available starting from Nuxt version 3.5.

useRequestURL composable signature

useRequestURL is a composable function that returns a URL object, working on both server-side and client-side. It provides access to the incoming request URL.

useRequestURL with Hybrid Rendering and caching

When using Hybrid Rendering with cache strategies, all incoming request headers are dropped when handling cached responses via the Nitro caching layer. This means useRequestURL will return localhost for the host. To preserve specific headers in cached responses, define the cache.varies option in Nitro configuration to specify headers like host and x-forwarded-host for multi-tenant environments.

useRequestURL example usage

Example showing useRequestURL in a Vue component: ```vue <script setup lang="ts"> const url = useRequestURL() </script> <template> <p>URL is: {{ url }}</p> <p>Path is: {{ url.pathname }}</p> </template> ``` This example demonstrates accessing the URL object and its pathname property in a page component.

useRequestURL returns URL object with pathname property

The URL object returned by useRequestURL has a pathname property that contains the path portion of the URL. For example, accessing url.pathname on http://localhost:3000/about returns /about.

Give your agent this brain