Skip to content

@serenity-is/corelib / isSameOrigin

Function: isSameOrigin()

isSameOrigin(url): boolean

Defined in: src/base/services.ts:56

Checks whether a URL is same-origin with the current page. Used to decide whether to attach the X-CSRF-TOKEN header.

Parameters

url

string

URL to test (absolute or relative; relative URLs are resolved against window.location.origin).

Returns

boolean

true if the URL shares hostname, port and protocol with window.location.