# internalRequest()

Makes a request to the CFML Engine internally. also available in 5.x as _internalRequest()

Great for CI / tests, internalRequest allows you to call another cfml page on the same server without needing to make an http call

## The `template` argument

The `template` is a path to a CFML template on the same server.

- A path **with** a leading slash is resolved from the root, from the web root and the mappings, for example `/app/index.cfm`.
- A path **without** a leading slash is relative to the directory of the template that calls the function, like in `cfinclude`. `./` and `../` are supported, for example `index.cfm`, `sub/index.cfm` or `../index.cfm`. The directory is taken from the virtual path of the caller, so it works for templates that are found through a mapping.
- A relative path that goes above the root with `../` throws an exception.

**Breaking change in Lucee 9.0** ([LDEV-4038](https://luceeserver.atlassian.net/browse/LDEV-4038)): before Lucee 9.0 a path without a leading slash was resolved from the root. Add the leading slash to such calls, see [Breaking Changes between Lucee 8.0 and 9.0](../../recipes/breaking-changes-9-0.md).

**Introduced:** 6.0.0.161

```
internalRequest( template=string, method=string, urls=any, forms=any, cookies=struct, headers=struct, body=any, charset=string, addToken=boolean, throwonerror=boolean );
```

**Returns:** struct

# Arguments

| Argument | Type | Required | Description | Default |
|----------|------|----------|-------------|---------|
| template | string | Yes | Template path (script name) for the request (example:/test/index.cfm). |  |
| method | string | No | method of the request (GET,POST,PUT,DELETE ...) | get |
| urls | any | No | URL scope passed to the request (query string). This can be a struct or a string following this format [name1=value1&name2=value2]. *Alias: url* |  |
| forms | any | No | FORM scope passed to the request.This can be a struct or a string following this format [name1=value1&name2=value2]. *Alias: form* |  |
| cookies | struct | No | Cookie scope passed to the request *Alias: cookie* |  |
| headers | struct | No | Request header entries passed to the request *Alias: header* |  |
| body | any | No | body to send with the request |  |
| charset | string | No | charset used for the request, if not set the web charset is used. |  |
| addToken | boolean | No | if yes add urlToken as cookie | false |
| throwonerror | boolean | No | if true (default) and the called page throws an exception, that exception is also thrown within the caller request. If false it is caught and only reported in the resulting struct. | true |

# Examples

*There are currently no examples for this function*







# Categories

[Internet Protocols](../../categories/protocols.md), [Lucee Server related Tags, Functions and Guides](../../categories/server.md)

# See Also

[<cfhttp>](../tags/http.md)