Created
June 3, 2018 22:52
-
-
Save mhilbrunner/fcfba1f1c4927d29c5dd6c318f0d7817 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extends Node2D | |
func _ready(): | |
$Button/request.connect("request_completed", self, "_request_completed") | |
func _on_Button_pressed(): | |
var fields = {"username" : "user", "password" : "pass"} | |
var queryString = HTTPClient.new().query_string_from_dict(fields) | |
print(queryString) | |
var headers = ["Content-Type: application/x-www-form-urlencoded", "Content-Length: " + str(queryString.length())] | |
$Button/request.request("https://postman-echo.com/get", headers, false, HTTPClient.METHOD_GET, queryString) | |
func _request_completed(result, response_code, headers, body): | |
print("Request completed", result, response_code, headers, body.get_string_from_utf8()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment