eddev 0.3.37 → 0.3.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@ const validProxyPaths = {
|
|
|
18
18
|
|
|
19
19
|
export default async function (req: NextApiRequest, res: NextApiResponse) {
|
|
20
20
|
// Ensure that the request is for a proxy path
|
|
21
|
-
const proxyPath = validProxyPaths[req.query.method[0] as keyof typeof validProxyPaths]!
|
|
21
|
+
const proxyPath = validProxyPaths[req.query.method![0] as keyof typeof validProxyPaths]!
|
|
22
22
|
|
|
23
23
|
if (!proxyPath) {
|
|
24
24
|
return res.status(404).json({
|
|
@@ -36,9 +36,14 @@ export default async function (req: NextApiRequest, res: NextApiResponse) {
|
|
|
36
36
|
{
|
|
37
37
|
method: proxyPath.method,
|
|
38
38
|
headers: {
|
|
39
|
-
"Content-Type": "application/json",
|
|
39
|
+
"Content-Type": req.headers["content-type"] ?? "application/json",
|
|
40
40
|
},
|
|
41
|
-
body:
|
|
41
|
+
body:
|
|
42
|
+
proxyPath.method === "POST"
|
|
43
|
+
? req.headers["content-type"] === "application/json"
|
|
44
|
+
? JSON.stringify(req.body)
|
|
45
|
+
: req.body
|
|
46
|
+
: undefined,
|
|
42
47
|
},
|
|
43
48
|
async (response) => ({
|
|
44
49
|
payload: await response.json(),
|