ProtectedbaseProtectedfieldProtectedvariantProtectedgenerateProtectedgetProtectedgetProtectedgetProtectedgetOptionaldefaultValue: numberProtectedgetOptionaldefaultValue: stringProtectedgetOptionalprefix: stringProtectedgetProtectedhttpOptionalselectedFacets: SelectedFacetsOptionaldisableSpellcheck: booleanOptionalquery: stringOptionalselectedFacets: SelectedFacetsOptionaldisableSpellcheck: booleanOptionalquery: stringOptionalrequestType: RequestTypeOptionalselectedFacets: SelectedFacetsOptionaldisableSpellcheck: booleanOptionalvalue: stringProtectedsetOptionalvalue: stringProtectedstripProtectedtriggerOptionalfilter: stringProtectedtrigger
Builds the request headers for HawkSearch API calls.
User-Agent,X-Forwarded-For,X-HawkSearch-ClientGuid, andX-HawkSearch-IgnoreTrackingare values a server-side HawkSearch SDK would normally populate automatically. Because this library calls the API directly from the browser, it reconstructs them here by hand.Everything is best-effort and defensive on purpose:
User-Agentis a browser "forbidden header" —fetchmay silently drop it or throw when it's set.window/navigator/ theHawkSearchglobal may be undefined, or wherenew Headers()/headers.set()themselves can throw.These headers are optional enrichment (analytics / geo / tracking), never required for the request to succeed — so a failure to build any one of them must never break a search. Each header is resolved and set in its own try/catch (see setHeaderSafe): a failing header is logged in debug mode and skipped while the rest still go out.