You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
fix image download example code
using "https://placehold.co/512" as the url will cause image.load_png_from_buffer(body) to throw ERR_FILE_CORRUPT, need to specify that it's a png file in the url.
This commit is contained in:
@@ -90,7 +90,7 @@
|
|||||||
http_request.request_completed.connect(self._http_request_completed)
|
http_request.request_completed.connect(self._http_request_completed)
|
||||||
|
|
||||||
# Perform the HTTP request. The URL below returns a PNG image as of writing.
|
# Perform the HTTP request. The URL below returns a PNG image as of writing.
|
||||||
var error = http_request.request("https://placehold.co/512")
|
var error = http_request.request("https://placehold.co/512.png")
|
||||||
if error != OK:
|
if error != OK:
|
||||||
push_error("An error occurred in the HTTP request.")
|
push_error("An error occurred in the HTTP request.")
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@
|
|||||||
httpRequest.RequestCompleted += HttpRequestCompleted;
|
httpRequest.RequestCompleted += HttpRequestCompleted;
|
||||||
|
|
||||||
// Perform the HTTP request. The URL below returns a PNG image as of writing.
|
// Perform the HTTP request. The URL below returns a PNG image as of writing.
|
||||||
Error error = httpRequest.Request("https://placehold.co/512");
|
Error error = httpRequest.Request("https://placehold.co/512.png");
|
||||||
if (error != Error.Ok)
|
if (error != Error.Ok)
|
||||||
{
|
{
|
||||||
GD.PushError("An error occurred in the HTTP request.");
|
GD.PushError("An error occurred in the HTTP request.");
|
||||||
|
|||||||
Reference in New Issue
Block a user