eddev 0.3.35 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.3.35",
3
+ "version": "0.3.38",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -3,7 +3,7 @@ import { fetchWP } from "../../../_utils/fetch-wp"
3
3
 
4
4
  const validProxyPaths = {
5
5
  "form-submit": {
6
- path: "/wp-json/ed/v1/gf/submit",
6
+ path: "/wp-json/ed/v1/gf/submit-with-uploads",
7
7
  method: "POST",
8
8
  },
9
9
  query: {
@@ -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: proxyPath.method === "POST" ? JSON.stringify(req.body) : undefined,
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(),
@@ -15,7 +15,7 @@ const handler = trpcNext.createNextApiHandler({
15
15
  if (allOk && isQuery) {
16
16
  return {
17
17
  headers: {
18
- "cache-control": `s-maxage=1, stale-while-revalidate=${ctx?.cacheTime || 60}`,
18
+ "cache-control": `public, s-maxage=${ctx?.cacheTime || 60}`,
19
19
  },
20
20
  }
21
21
  }