# HyperBuilder

A `HyperBuilder` is a singleton factory component that will give you a new [`HyperRequest`](/7.4.0-1/making-requests/hyperrequest.md) any time you call the `new` method.  It will also create a new [`HyperRequest`](/7.4.0-1/making-requests/hyperrequest.md) any time you call a method on `HyperBuilder` that exists on [`HyperRequest`](/7.4.0-1/making-requests/hyperrequest.md).

`HyperBuilder` is the component you want to inject into your singleton components, like handlers or services.  It will ensure you get a fresh [`HyperRequest`](/7.4.0-1/making-requests/hyperrequest.md) instance on each invocation.  This is important since reusing the same [`HyperRequest`](/7.4.0-1/making-requests/hyperrequest.md) instance will likely produce unintended results.

You can inject a `HyperBuilder` into your application using the `HyperBuilder@hyper` id.

```cfscript
component {
    
    property name="hyper" inject="HyperBuilder@hyper";

    function index( event, rc, prc ) {
        var reqA = hyper.new();
        // reqA is a new HyperRequest instance.
        
        var reqB = hyper.setUrl( "https://swapi.dev/api/people" );
        // reqB is a new HyperRequest instance with the url set.
    }

}
```

If you are not using ColdBox, you can create a `HyperBuilder` manually:

```cfscript
component {

    function init() {
        variables.hyper = new hyper.models.HyperBuilder();
    }

}
```

Additionally, you can register `HyperBuilder` instances as custom HTTP Clients.

{% content-ref url="/pages/sc1pmftTrug5lkmdOWQS" %}
[Custom HTTP Clients](/7.4.0-1/customizing-hyper/custom-http-clients.md)
{% endcontent-ref %}

Finally, you can enable faking of requests from any `HyperBuilder` instance.

{% content-ref url="/pages/fDs68ouvcjilusPgzOdw" %}
[Faking Requests](/7.4.0-1/testing/faking-requests.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hyper.ortusbooks.com/7.4.0-1/making-requests/hyperbuilder.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
