Make code example in HTTPRequest classref working

This commit is contained in:
Haoyu Qiu 2022-06-24 12:05:21 +08:00 committed by Relintai
parent 149baac627
commit 4bbbf1816f

View File

@ -23,7 +23,7 @@
# Perform a POST request. The URL below returns JSON as of writing. # Perform a POST request. The URL below returns JSON as of writing.
# Note: Don't make simultaneous requests using a single HTTPRequest node. # Note: Don't make simultaneous requests using a single HTTPRequest node.
# The snippet below is provided for reference only. # The snippet below is provided for reference only.
var body = {"name": "Godette"} var body = to_json({"name": "Godette"})
error = http_request.request("https://httpbin.org/post", [], true, HTTPClient.METHOD_POST, body) error = http_request.request("https://httpbin.org/post", [], true, HTTPClient.METHOD_POST, body)
if error != OK: if error != OK:
push_error("An error occurred in the HTTP request.") push_error("An error occurred in the HTTP request.")