cleanup rageshake code

This commit is contained in:
Bruno Windels 2022-06-15 11:13:05 +02:00
parent 2129a97588
commit 69ada73dd4

View file

@ -14,8 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import {encodeBody} from "../matrix/net/common";
import type {BlobHandle} from "../platform/web/dom/BlobHandle"; import type {BlobHandle} from "../platform/web/dom/BlobHandle";
import type {RequestFunction} from "../platform/types/types"; import type {RequestFunction} from "../platform/types/types";
@ -45,13 +43,11 @@ export async function submitLogsToRageshakeServer(data: RageshakeData, logsBlob:
formData.set("label", data.label); formData.set("label", data.label);
} }
formData.set("file", {name: "logs.json", blob: logsBlob}); formData.set("file", {name: "logs.json", blob: logsBlob});
const encoded = encodeBody(formData);
const headers: Map<string, string> = new Map(); const headers: Map<string, string> = new Map();
headers.set("Accept", "application/json"); headers.set("Accept", "application/json");
//headers.set("Content-Type", encoded.mimeType);
const result = request(submitUrl, { const result = request(submitUrl, {
method: "POST", method: "POST",
body: encoded.body, body: formData,
headers headers
}); });
let response; let response;
@ -64,4 +60,6 @@ export async function submitLogsToRageshakeServer(data: RageshakeData, logsBlob:
if (status < 200 || status >= 300) { if (status < 200 || status >= 300) {
throw new Error(`Could not submit logs to ${submitUrl}, got status code ${status} with body ${body}`); throw new Error(`Could not submit logs to ${submitUrl}, got status code ${status} with body ${body}`);
} }
// we don't bother with reading report_url from the body as the rageshake server doesn't always return it
// and would have to have CORS setup properly for us to be able to read it.
} }