We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c20260b + 6dd1dd4 commit 8e7c1e1Copy full SHA for 8e7c1e1
functions/index.js
@@ -59,14 +59,16 @@ exports.cors = functions.https.onRequest((req, res) => {
59
}, {});
60
61
// Send Interpreted Request to intended endpoint:
62
- return fetch(url, {
+ let fwdRequest = {
63
method: req.method,
64
- body:
65
- req.get('content-type') === 'application/json'
66
- ? JSON.stringify(req.body)
67
- : req.body,
68
- headers
69
- }).then(r => {
+ headers,
+ };
+ if (req.method === "POST" || req.method === "PUT") {
+ req.get("content-type") === "application/json"
+ ? (fwdRequest.body = JSON.stringify(req.body))
+ : (fwdRequest.body = req.body);
70
+ }
71
+ return fetch(url, fwdRequest).then(r => {
72
r.body.on('data', chunk => {
73
res.write(chunk);
74
});
0 commit comments