From f7a48f5a326a83efc998050501f7ce0d4dd563ca Mon Sep 17 00:00:00 2001 From: Landlocked Surfer Date: Wed, 5 May 2021 21:26:39 +0200 Subject: [PATCH] add withCredentials config option --- src/htmx.js | 2 ++ www/api.md | 1 + 2 files changed, 3 insertions(+) diff --git a/src/htmx.js b/src/htmx.js index afa5f50b..b30ae423 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -49,6 +49,7 @@ return (function () { swappingClass:'htmx-swapping', allowEval:true, attributesToSettle:["class", "style", "width", "height"], + withCredentials:false, wsReconnectDelay: 'full-jitter', disableSelector: "[hx-disable], [data-hx-disable]", }, @@ -2145,6 +2146,7 @@ return (function () { } xhr.overrideMimeType("text/html"); + xhr.withCredentials = htmx.config.withCredentials; // request headers for (var header in headers) { diff --git a/www/api.md b/www/api.md index 1d177c0e..4e7d3e79 100644 --- a/www/api.md +++ b/www/api.md @@ -98,6 +98,7 @@ Note that using a [meta tag](/docs/#config) is the preferred mechanism for setti * `settlingClass:'htmx-settling'` - string: the class to place on target elements when htmx is in the settling phase * `swappingClass:'htmx-swapping'` - string: the class to place on target elements when htmx is in the swapping phase * `allowEval:true` - boolean: allows the use of eval-like functionality in htmx, to enable `hx-vars`, trigger conditions & script tag evaluation. Can be set to `false` for CSP compatibility +* `withCredentials:false` - boolean: allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates * `wsReconnectDelay:full-jitter` - string/function: the default implementation of `getWebSocketReconnectDelay` for reconnecting after unexpected connection loss by the event code `Abnormal Closure`, `Service Restart` or `Try Again Later` ##### Example