eddev 0.2.0-beta.24 → 0.2.0-beta.25

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.2.0-beta.24",
3
+ "version": "0.2.0-beta.25",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -9,23 +9,18 @@ const handler = trpcNext.createNextApiHandler({
9
9
  })
10
10
 
11
11
  export default function (req: NextApiRequest, res: NextApiResponse) {
12
- console.log("Req", req.method)
13
- // if (req.method === "OPTIONS") {
12
+ // TODO: Use an origin whitelist
14
13
  const origin = req.headers.origin
15
14
  if (origin) {
16
- console.log(origin)
17
- if (origin.match(/\.local$/)) {
18
- res.setHeader("Access-Control-Allow-Origin", "*")
19
- res.setHeader("Access-Control-Request-Method", "*")
20
- res.setHeader("Access-Control-Request-Method", "OPTIONS, GET, POST")
21
- res.setHeader("Access-Control-Allow-Headers", "*")
22
- if (req.method === "OPTIONS") {
23
- res.writeHead(200)
24
- res.end()
25
- return
26
- }
15
+ res.setHeader("Access-Control-Allow-Origin", "*")
16
+ res.setHeader("Access-Control-Request-Method", "*")
17
+ res.setHeader("Access-Control-Request-Method", "OPTIONS, GET, POST")
18
+ res.setHeader("Access-Control-Allow-Headers", "*")
19
+ if (req.method === "OPTIONS") {
20
+ res.writeHead(200)
21
+ res.end()
22
+ return
27
23
  }
28
24
  }
29
- // }
30
25
  return handler(req, res)
31
26
  }