Skip to content

Commit

Permalink
Add application/json header to gulp proxy if it doesn't exist
Browse files Browse the repository at this point in the history
Not sure why this is needed when proxying, but it seems to be now that
we've switched to fetch based requests.
  • Loading branch information
anoek committed Nov 2, 2023
1 parent c5e5c8d commit 581bbe2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ function dev_server(done) {
console.log("-->", path);
return path;
},
proxyReqOptDecorator: function (proxyReqOpts, srcReq) {
return new Promise(function (resolve, reject) {
if (!("Content-Type" in srcReq.headers)) {
proxyReqOpts.headers["Content-Type"] = "application/json";
}
resolve(proxyReqOpts);
});
},
});

devserver.use("/api", backend_proxy("/api"));
Expand Down

0 comments on commit 581bbe2

Please sign in to comment.