HttpRequest
HttpRequest
This class represents the HttpRequest that is sent out after it was processed
| Metatable function | Description |
|---|---|
__tostring |
Returns a formated string of the HttpRequest -> HttpRequest |
__index |
Used to find the functions on the metatable and access saved variables |
__newindex |
Used to allow one to save variables on the object |
Methods
number HttpRequest:GetAuthorizationCount( )
CBaseClient HttpRequest:GetClient( )
Returns the client who sent the HTTP Request or NULL if it didn't find it.
number HttpRequest:GetContentLength( )
The length of the HTTP Request content.
string HttpRequest:GetLocalAddr( )
number HttpRequest:GetLocalPort( )
Returns the raw request path, e.g. /users/42.
Unlike HttpRequest:GetPathParam, this returns the whole path as-is instead of extracting a named path parameter from it.
Unlike HttpRequest:GetPathParam, this returns the whole path as-is instead of extracting a named path parameter from it.
returns the value of the given key from path parameters.
Returns the player who sent the HTTP Request or NULL if it didn't find it.
string HttpRequest:GetRemoteAddr( )
the IP Address of the Person who sent the HTTP Request
number HttpRequest:GetRemotePort( )
The Port the HTTP request was received from.
returns true if the client has the given key in the header.
returns true if the client has the given key in the parameters.
HttpRequest:MarkHandled()
Marks the request as handled.
The worker thread that is waiting on this request will pick this up, send the response back to the client and delete the request.
Returning any value other than false from a request handler (see HttpServer:Get and the other method functions) will call this automatically, so you usually don't need to call this yourself.
If a request handler errors out, it will also be marked as handled automatically. Once a request was marked handled, the HttpRequest becomes invalid and must no longer be used!
The worker thread that is waiting on this request will pick this up, send the response back to the client and delete the request.
Returning any value other than false from a request handler (see HttpServer:Get and the other method functions) will call this automatically, so you usually don't need to call this yourself.
If a request handler errors out, it will also be marked as handled automatically. Once a request was marked handled, the HttpRequest becomes invalid and must no longer be used!
Sets the content for the response.
Sets the given value for the given key in the header.
Redirects one to the given URL and returns the given code.
HttpRequest:SetStatusCode( number status )
Sets the status code of the response, clamped between 100 and 600.