Xlinka / NeosPlus

NeosVR Plugin Extra Logix nodes and features
https://discord.gg/9QAaMtXwke
Other
29 stars 18 forks source link

HTTP Request Node #109

Closed Lexevolution closed 2 years ago

Lexevolution commented 2 years ago

A Logix node that allows generic HTTP Requests, with a multitude of Request Types, and includes the ability to add Headers.

The node is located in the Network folder in the logix browser. It has a Request Type enum input, for choosing the request type, a URL input, a Request Headers string input, which is a line separated list of headers, and a request body string input.

When pulsed, the onSent will fire immediately, and if there is no problems, after a short time period, the onResponse should pulse, and will include the responseHeaders, responseBody, and statusCode (all of these only last the duration of the pulse). If an error occurs for any reason (be it network errors or C# errors), the onError will pulse and a message will be included in the responseBody, and an entry in the log file will be created. The error might also include a status code.

The enum type for the request type is FrooxEngine.LogiX.Network.HTTPRequest+RequestType

How to use the RequestHeaders String

If you need to use headers, then you structure them in a newline separated list, with a : as the delimiter for the key and value. The keys and values can have any amounts of whitespace, but not extra newlines. Example:

Authorization: Bearer xxxxxxx
TOTP:112233
Content-Type     :   application/json

If you are including a body in your request, you need the Content-Type header. The headers can be in any order. They do not need quotation marks of any kind. This is most likely the area where you will get most errors, so please check the HTTP specifications to see whether you included all the headers you need.

Image examples

These examples are using the Neos API to test the node.

image image

image

Xlinka commented 2 years ago

Links to what is involved from @Lexevolution

https://github.com/Neos-Metaverse/NeosPublic/issues/222 https://github.com/Neos-Metaverse/NeosPublic/issues/1069 https://github.com/Neos-Metaverse/NeosPublic/issues/2101 (I implemented this in the node) https://github.com/Neos-Metaverse/NeosPublic/issues/2454