HolyLib Wiki

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

string HttpRequest:GetBody( )
The body of the HTTP Request.
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:GetHeader( string key )
returns the value of the given key from the header.
string HttpRequest:GetLocalAddr( )
number HttpRequest:GetLocalPort( )
string HttpRequest:GetMethod( )
The HTTP Method that was used like GET or PUT.
string HttpRequest:GetParam( string key )
returns the value of the given key from the parameters.
string HttpRequest:GetPathParam( string key )
returns the value of the given key from path parameters.
Player HttpRequest:GetPlayer( )
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.
table HttpRequest:GetTable( )
Returns the lua table used by newindex and index
boolean HttpRequest:HasHeader( string key )
returns true if the client has the given key in the header.
boolean HttpRequest:HasParam( string key )
returns true if the client has the given key in the parameters.
boolean HttpRequest:IsValid( )
Returns whether this HttpRequest is valid.
HttpRequest:SetContent( string content, string contentType = text/plain )
Sets the content for the response.
HttpRequest:SetHeader( string key, string value )
Sets the given value for the given key in the header.
HttpRequest:SetRedirect( string url, number code = 302 )
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.