#http request method patch

1 messages · Page 1 of 1 (latest)

ashen marsh
#

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

GitHub

Contribute to SenyuDev/BedCord-Api development by creating an account on GitHub.

smoky python
#

@ashen marsh For what can this be used ?

wind abyss
ashen marsh
wind abyss
#

I wonder why patch doesnt exist in server net

#

guessing they just forgot

loud cobalt
#

@candid idol