This is an automated email from the ASF dual-hosted git repository.
benw pushed a commit to branch javax
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git
The following commit(s) were added to refs/heads/javax by this push:
new 1ed4c28f4 TAP5-2782: Supporting custom headers in t5/core/ajax calls
1ed4c28f4 is described below
commit 1ed4c28f462300bee81a22e1bc97ebb35dc9f6ad
Author: Ben Weidig <[email protected]>
AuthorDate: Mon Nov 11 09:14:45 2024 +0100
TAP5-2782: Supporting custom headers in t5/core/ajax calls
---
.../preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee | 3 +++
1 file changed, 3 insertions(+)
diff --git
a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
index bf2454812..07234a83e 100644
---
a/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
+++
b/tapestry-core/src/main/preprocessed-coffeescript/org/apache/tapestry5/t5-core-dom.coffee
@@ -701,6 +701,7 @@ define ["underscore", "./utils", "./events", "jquery"],
# * options.method - "post", "get", etc., default: "post".
# * options.contentType - request content, defaults to
"application/x-www-form-urlencoded"
# * options.data - optional, additional key/value pairs (for the default
content type)
+ # * options.headers - optional, additional key/value pairs to be added to
the request headers.
# * options.success - handler to invoke on success. Passed the
ResponseWrapper object.
# Default does nothing.
# * options.failure - handler to invoke on failure (server responds with a
non-2xx code).
@@ -717,6 +718,7 @@ define ["underscore", "./utils", "./events", "jquery"],
contentType: options.contentType
traditional: true
data: options.data
+ headers: options.headers or {}
# jQuery doesn't have the equivalent of Protoype's onException
error: (jqXHR, textStatus, errorThrown) ->
adjustAjaxCount -1
@@ -750,6 +752,7 @@ define ["underscore", "./utils", "./events", "jquery"],
method: options.method or "post"
contentType: options.contentType or "application/x-www-form-urlencoded"
parameters: options.data
+ requestHeaders: options.headers
onException: (ajaxRequest, exception) ->
adjustAjaxCount -1