Performs a simple HTTP get request in behavior packs.
url
:string
- Returns:
Promise<
HttpResponse
>
Since most requests are GET requests without bodies, @minecraft/server-net provides this convenience method. The only difference between this method and http.request()
is that it sets the method to GET
automatically.
Example:
import { http } from '@minecraft/server-net';
http.get('http://localhost:8000/').then((response) => {
// Body content of the HTTP response.
// Type: string
const body = response.body;
});