Fixture.requestHooks Method

Attaches the request hooks to the fixture.

fixture.requestHooks(...hooks)
Parameter Type Description
hooks RequestHook subclass A RequestLogger, RequestMock or custom user-defined hook.

The fixture.requestHooks method uses the rest operator, which allows you to pass multiple hooks as parameters or arrays of hooks.

Request hooks attached to a fixture intercept requests from all tests in this fixture.

You can also use the test.requestHooks method to attach request hooks to an individual test.

Request hooks attached to a fixture are invoked before the hooks attached to individual tests.

The t.addRequestHooks method allows you to attach request hooks throughout test execution.

To remove attached request hooks, use the t.removeRequestHooks method.