---
title: roHttpEvent
slug: develop/rohttpevent
docTags: 
createdAt: 2025-03-11T07:07:18.732Z
---

This event object is used to handle requests generated by the *roHttpServer* object.

## ifHttpEvent

### GetFailureReason() As String

Yields additional useful information if a function return indicates an error.

### GetMethod() As String

Returns the type of HTTP method that triggered the event on the *roHttpServer* instance.

### SetResponseBodyString(body As String)

Sets the response body for an event generated via the `AddGetFromEvent()` or `AddMethodToString()` method on the *roHttpServer* object. This call is ignored with any other event.

### SetResponseBodyFile(filename As String) As Boolean

Specifies the name of a file to use as the source response body for an event generated via the `AddGetFromEvent()` or `AddMethodToString()` method on the *roHttpServer* object. This call is ignored with any other event. This function will return `False` if the file cannot be opened or another failure occurs.

The specified file is read gradually as it is sent to the client.

### GetRequestBodyString() As String

Returns the string received if the event was generated via *roHttpServer.AddPostToString()*. An empty string is returned with any other event.

### GetRequestBodyFile() As String

Returns the name of the temporary file created if the event is generated via *roHttpServer.AddGetFromEvent*. This call is ignored with any other event.

### GetRequestHeader(header\_name As String) As String

Returns the value of the specified HTTP request header. If the header does not exist, an empty string is returned.

### GetRequestHeaders() As Object

Returns an *roAssociativeArray* containing all the HTTP request headers.

### GetRequestParam(URI\_parameter As String) As String

Returns the value of the specified URI parameter. If the parameter does not exist, an empty string is returned.

### GetRequestParams() As Object

Returns an *roAssociativeArray* containing all the URI parameters.

### AddResponseHeader(header As String, value As String) As Boolean

Adds the specified HTTP header and value to the response. This function returns `True` upon success.

### AddResponseHeaders(a As Object) As Boolean

Adds the specified HTTP header/value pairs to the response. This method expects an *roAssociativeArray* of header names mapped to header values, which can be of type *roString*, *roInt*, or *roFloat*. Any other value types will cause the request to fail, though a subset of headers to might be set before the failure occurs. This function returns `True` upon success.

### SendResponse(http\_status\_code As Integer) As Boolean

Sends the HTTP response using the specified HTTP status code. To ensure that the response is sent, this function needs to be called once the script has finished handling the event. This function returns `False` upon failure.

### GetFormData() As Object

Returns an *roAssociativeArray* containing all the form data. See the entry on *roHttpServer.AddPostToFormData()* for more information.

### GetUrl() As String

## ifUserData

### SetUserData(user\_data As Object)

Sets the user data that will be returned when events are raised.

### GetUserData() As Object

Returns the user data that has previously been set via `SetUserData()`. It will return `Invalid` if no data has been set.
