Skip to content

Commit 2829450

Browse files
authored
docs: document SHAFT.API setFollowRedirects request builder option (#771)
RequestBuilder gained setFollowRedirects(boolean) (SHAFT_ENGINE #3571 / #3530 A3). Add a Follow Redirects subsection to the Request Builder reference, explaining that it is required to assert a 3xx status or inspect the Location header (REST-Assured follows redirects by default).
1 parent 6ef1f28 commit 2829450

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

docs/reference/actions/API/Request_Builder.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,15 @@ SHAFT.API api = new SHAFT.API("https://jsonplaceholder.typicode.com");
114114
api.get("/users").setTargetStatusCode(200);
115115
```
116116

117+
### Follow Redirects
118+
By default the request automatically follows HTTP redirects (3xx), so a redirecting endpoint returns the final response. Call **setFollowRedirects(false)** to receive the redirect response itself — required when asserting a 3xx status code or inspecting the `Location` header of the redirect.
119+
```java
120+
SHAFT.API api = new SHAFT.API("https://httpbin.org");
121+
api.get("/redirect-to?url=/get")
122+
.setFollowRedirects(false)
123+
.setTargetStatusCode(302);
124+
```
125+
117126
### Retry Policy
118127
`perform()` sends a request once unless you add an opt-in retry policy. Retries are useful for transient network failures, timeouts, rate limits, and temporary upstream errors without rerunning the whole test method.
119128

0 commit comments

Comments
 (0)