[Pkg-javascript-commits] [dojo] 09/23: Ensure dojo/text does not cause preflight requests
David Prévot
taffit at moszumanska.debian.org
Sun Sep 14 16:23:11 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag 1.9.4
in repository dojo.
commit c5e66300de4a8cc76a6e1ad338389384f19bf6af
Author: Colin Snover <github.com at zetafleet.com>
Date: Tue Apr 22 02:17:09 2014 +0000
Ensure dojo/text does not cause preflight requests
Fixes #17493.
(cherry picked from commit 56703ec1fa0bd1901b259dc83404f3db5d92c9e4)
---
tests/module.js | 1 +
tests/text.html | 20 ++++++++++++++++++++
tests/text.js | 5 +++++
tests/text.php | 11 +++++++++++
text.js | 2 +-
5 files changed, 38 insertions(+), 1 deletion(-)
diff --git a/tests/module.js b/tests/module.js
index 0f81774..3cc9a6a 100644
--- a/tests/module.js
+++ b/tests/module.js
@@ -24,6 +24,7 @@ define([
"dojo/tests/DeferredList",
"dojo/tests/Stateful",
"dojo/tests/errors",
+ "dojo/tests/text",
"dojo/has!host-node?dojo/tests/node",
"dojo/has!host-browser?dojo/tests/router",
"dojo/has!host-browser?dojo/tests/request",
diff --git a/tests/text.html b/tests/text.html
new file mode 100644
index 0000000..53c16e4
--- /dev/null
+++ b/tests/text.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>dojo/text</title>
+ <meta charset="utf-8">
+ </head>
+ <body>
+ <script src="../dojo.js" data-dojo-config="async: 1"></script>
+ <script>
+require([ "doh", "dojo/text!dojo/tests/text.php", "dojo/json" ], function(doh, data, JSON){
+ doh.register(function checkRequestHeader(t){
+ data = JSON.parse(data);
+ t.f(data['x-requested-with']);
+ });
+
+ doh.run();
+});
+ </script>
+ </body>
+</html>
diff --git a/tests/text.js b/tests/text.js
new file mode 100644
index 0000000..9c85681
--- /dev/null
+++ b/tests/text.js
@@ -0,0 +1,5 @@
+define([ "doh", "dojo/has", "require" ], function (doh, has, require) {
+ if(has("host-browser")){
+ doh.registerUrl("tests.text", require.toUrl("./text.html"), 30000);
+ }
+});
diff --git a/tests/text.php b/tests/text.php
new file mode 100644
index 0000000..df8e085
--- /dev/null
+++ b/tests/text.php
@@ -0,0 +1,11 @@
+<?php
+
+$headers = array();
+foreach($_SERVER as $key => $value) {
+ if (strpos($key, 'HTTP_') === 0) {
+ $headers[strtolower(str_replace('_', '-', substr($key, 5)))] = $value;
+ }
+}
+
+header('Content-Type: application/json');
+echo json_encode($headers);
diff --git a/text.js b/text.js
index e7714de..9a4839e 100644
--- a/text.js
+++ b/text.js
@@ -5,7 +5,7 @@ define(["./_base/kernel", "require", "./has", "./has!host-browser?./request"], f
var getText;
if(has("host-browser")){
getText= function(url, sync, load){
- request(url, {sync:!!sync}).then(load);
+ request(url, {sync:!!sync, headers: { 'X-Requested-With': null } }).then(load);
};
}else{
// Path for node.js and rhino, to load from local file system.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git
More information about the Pkg-javascript-commits
mailing list