MCPcopy Create free account
hub / github.com/ampproject/amphtml / getSameSiteString

Function getSameSiteString

src/cookies.js:226–232  ·  view source on GitHub ↗

* Gets the cookie string to use for SameSite. This only sets the SameSite * value if specified, falling back to the browser default. The default value * is equivalent to SameSite_Enum.NONE, but is planned to be set to SameSite_Enum.LAX in * Chrome 80. * * Note: In Safari 12, if the value is set

(win, sameSite)

Source from the content-addressed store, hash-verified

224 * @return {string} The string to use when setting the cookie.
225 */
226function getSameSiteString(win, sameSite) {
227 if (!sameSite) {
228 return '';
229 }
230
231 return `; SameSite=${sameSite}`;
232}
233
234/**
235 * Throws if a given cookie should not be set on the given origin.

Callers 1

trySetCookieFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected