You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by be...@apache.org on 2024/11/11 08:15:20 UTC

(tapestry-5) branch master updated: TAP5-2782: Supporting custom headers in t5/core/ajax calls

This is an automated email from the ASF dual-hosted git repository.

benw pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/master by this push:
     new baec415d9 TAP5-2782: Supporting custom headers in t5/core/ajax calls
baec415d9 is described below

commit baec415d9a63d282ec3edd2a6fc8a4d27bd18b9a
Author: Ben Weidig <be...@netzgut.net>
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