Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 2d45c9d

Browse files
hugomrdiasAlan Shaw
authored and
Alan Shaw
committed
fix: add cors support for preload-mock-server and update aegir (#1839)
1 parent c8cb245 commit 2d45c9d

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
},
6363
"homepage": "https://github.com./ipfs/js-ipfs#readme",
6464
"devDependencies": {
65-
"aegir": "^17.1.1",
65+
"aegir": "^18.0.3",
6666
"chai": "^4.2.0",
6767
"delay": "^4.1.0",
6868
"detect-node": "^2.0.4",

test/utils/mock-preload-node.js

+9
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ module.exports.createNode = () => {
1919
let cids = []
2020

2121
const server = http.createServer((req, res) => {
22+
res.setHeader('Access-Control-Allow-Origin', '*')
23+
res.setHeader('Access-Control-Request-Method', '*')
24+
res.setHeader('Access-Control-Allow-Methods', 'OPTIONS, GET, DELETE')
25+
res.setHeader('Access-Control-Allow-Headers', '*')
26+
if (req.method === 'OPTIONS') {
27+
res.writeHead(200)
28+
res.end()
29+
return
30+
}
2231
if (req.url.startsWith('/api/v0/refs')) {
2332
const arg = new URL(`https://ipfs.io${req.url}`).searchParams.get('arg')
2433
cids = cids.concat(arg)

0 commit comments

Comments
 (0)