Skip to content

Commit 6d6dfb1

Browse files
committed
Documentation examples: send JSON as text/plain to avoid an additional preflight OPTIONs request
1 parent cc6bc80 commit 6d6dfb1

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)