mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-14 15:24:52 +09:00
Merge remote-tracking branch 'origin/master' into host-pairing
# Conflicts: # test/integration/clusterio.js
This commit is contained in:
36 files changed
+661
-307
No files matched your search
+10
-16
@@ -1,6 +1,5 @@
|
||||
import assert from "node:assert/strict";
|
||||
import events from "node:events";
|
||||
import FormData from "form-data";
|
||||
import http from "node:http";
|
||||
|
||||
import jwt from "jsonwebtoken";
|
||||
@@ -590,27 +589,25 @@ describe("controller/src/routes", function() {
|
||||
let form;
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "text/plain" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "text/plain" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(await response.json(), { request_errors: ["invalid file Content-Type"] });
|
||||
form = new FormData();
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
form.append("instance_id", "123");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -618,14 +615,13 @@ describe("controller/src/routes", function() {
|
||||
);
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.txt", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.txt");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -633,14 +629,13 @@ describe("controller/src/routes", function() {
|
||||
);
|
||||
form = new FormData();
|
||||
form.append("instance_id", "invalid");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 400);
|
||||
assert.deepEqual(
|
||||
@@ -692,14 +687,13 @@ describe("controller/src/routes", function() {
|
||||
let form;
|
||||
form = new FormData();
|
||||
form.append("instance_id", "123");
|
||||
form.append("file", "totally a zip file", { filename: "test.zip", contentType: "application/zip" });
|
||||
form.append("file", new Blob(["totally a zip file"], { type: "application/zip" }), "test.zip");
|
||||
response = await fetch(endpoint, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Access-Token": testToken,
|
||||
...form.getHeaders(),
|
||||
},
|
||||
body: form.getBuffer(),
|
||||
body: form,
|
||||
});
|
||||
assert.equal(response.status, 500);
|
||||
assert.deepEqual(await response.json(), { errors: ["Something went wrong"], request_errors: [] });
|
||||
|
||||
Reference in new issue
Block a user