diff --git a/projects/web/src/main/java/dan200/computercraft/core/apis/http/request/THttpRequest.java b/projects/web/src/main/java/dan200/computercraft/core/apis/http/request/THttpRequest.java index 27917c9f8..1a87e517f 100644 --- a/projects/web/src/main/java/dan200/computercraft/core/apis/http/request/THttpRequest.java +++ b/projects/web/src/main/java/dan200/computercraft/core/apis/http/request/THttpRequest.java @@ -47,6 +47,7 @@ public class THttpRequest extends Resource { private final @Nullable String postBuffer; private final HttpHeaders headers; private final boolean binary; + private final boolean followRedirects; public THttpRequest( ResourceGroup limiter, IAPIEnvironment environment, String address, @Nullable String postText, @@ -58,6 +59,7 @@ public class THttpRequest extends Resource { postBuffer = postText; this.headers = headers; this.binary = binary; + this.followRedirects = followRedirects; if (postText != null) { if (!headers.contains(HttpHeaderNames.CONTENT_TYPE)) { @@ -102,6 +104,7 @@ public class THttpRequest extends Resource { var header = iterator.next(); request.setRequestHeader(header.getKey(), header.getValue()); } + request.setRequestHeader("X-CC-Redirect", followRedirects ? "true" : "false"); request.send(postBuffer); checkClosed(); } catch (Exception e) {