Convert an httprequest from post to patch, the server-net api has a limited number of methods and in some cases (for example communicating with the discord api) you need the patch method which the minecraft/server-net api does not have ( bds), here I have a solution that converts a post request to a patch, you just have to put the link to which you want to make the post in the query
Example:
import { http, HttpHeader, HttpRequest, HttpRequestMethod } from "@minecraft/server-net";
export async function request(url, body, headers,method) {
const request = new HttpRequest("https://bedcord-api-senyuapp.koyeb.app/patch?link="+url)
.setBody(JSON.stringify(body))
.setHeaders(headers)
.setMethod(method);
try {
const res = await http.request(request)
return res;
}
catch (error) {
console.warn(error);
}
}
https://bedcord-api-senyuapp.koyeb.app/patch?link=
If you are distrustful because I could steal information that you are sending to my server, here I leave the github so you can host it or see the code for yourself
https://github.com/SenyuDev/BedCord-Api/tree/main
I plan to implement many useful things for the discord connection api or ways to improve minecraft/server-net limitations any suggestion is welcome