#searchParams doest work
3 messages · Page 1 of 1 (latest)
Hi @glacial drift. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
In Astro, the Astro.request object is a standard Request (https://developer.mozilla.org/en-US/docs/Web/API/Request) object that can be used to get the url, headers, method, and even body of the request. However, with the default output: 'static' option, Astro.request.url does not contain search parameters, like ?foo=bar, as it’s not possible to determine them ahead of time during static builds.
If you are trying to get URL parameters during a static build, it won't work. However, in output: 'server' mode, Astro.request.url does contain search parameters as it can be determined from a server request.
Here is the reference from the Astro documentation (https://docs.astro.build/en/reference/api-reference/#astrorequest).