mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-04 14:11:02 +03:00
Merge pull request #1363 from mhilbrunner/http-headers
HTTPRequest: Add HTTP header example, notes about SSL and tokens
This commit is contained in:
committed by
mhilbrunner
parent
73c0bbc940
commit
5e69d07c15
@@ -43,6 +43,18 @@ For more information on parsing JSON, see the class references for :ref:`JSON <c
|
||||
|
||||
Note that you may want to check whether the ``result`` equals ``RESULT_SUCCESS`` and whether a JSON parsing error occurred, see the JSON class reference and :ref:`HTTPRequest <class_HTTPRequest>` for more.
|
||||
|
||||
Of course, you can also set custom HTTP headers. These are given as a string array, with each string containing a header in the format ``"header: value"``.
|
||||
For example, to set a custom user agent (the HTTP ``user-agent`` header) you could use the following:
|
||||
|
||||
::
|
||||
|
||||
$HTTPRequest.request("http://www.mocky.io/v2/5185415ba171ea3a00704eed", ["user-agent: YourCustomUserAgent"])
|
||||
|
||||
Please note that for SSL/TLS encryption and thus HTTPS URLs to work you may need to take some steps as described :ref:`here <doc_ssl_certificates>`.
|
||||
|
||||
Also, when calling APIs using authorization, be aware that someone might analyse and decompile your released application and thus may gain access to any embedded authorization information like tokens, usernames or passwords.
|
||||
That means it is usually not a good idea to embed things such as database access credentials inside your game. Avoid providing information useful to an attacker whenever possible.
|
||||
|
||||
Sending data to server
|
||||
----------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user