Skip to main content

Request Builder

PrismRequestBuilder provides a chainable API for constructing test requests. Instead of manually creating PrismHTTPRequest instances with method, path, headers, and body, chain methods together for readable test code.

Basic Usage

Building Requests

HTTP Methods

Method Factories

Adding Headers

Chain Headers

Setting the Body

Raw Data

Raw Body

JSON Body

JSON Body

Complete Examples

Test with Request Builder

Why Use Request Builder?

Compare the manual approach vs the builder:
Without Builder
With Builder
PrismRequestBuilder is immutable — each chained method returns a new copy. You can create a base builder and branch from it for variations: