Skip to content

Commit 5eaf06c

Browse files
authored
Merge pull request #1781 from wilzbach/avoid-preflight
Documentation examples: send JSON as text/plain to avoid an additional preflight OPTIONs request merged-on-behalf-of: Vladimir Panteleev <github@thecybershadow.net>
2 parents 5c29ef1 + 6d6dfb1 commit 5eaf06c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

js/run.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ var backends = {
9292
},
9393
tour: {
9494
url: "https://tour.dlang.org/api/v1/run",
95-
contentType: "application/json; charset=utf-8",
95+
// send json as text/plain to avoid an additional preflight OPTIONS request
96+
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests
97+
contentType: "text/plain; charset=UTF-8",
9698
requestTransform: function(data) {
9799
return JSON.stringify({
98100
source: data.code

0 commit comments

Comments
 (0)