Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dependencies/default/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
<rxjava.version>3.1.8</rxjava.version>
<seanyinx.version>1.0.0</seanyinx.version>
<servo.version>0.13.2</servo.version>
<servlet-api.version>6.0.0</servlet-api.version>
<servlet-api.version>6.1.0</servlet-api.version>
<slf4j.version>1.7.36</slf4j.version>
<snakeyaml.version>2.3</snakeyaml.version>
<spring.version>6.1.10</spring.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.function.Supplier;

import io.vertx.core.buffer.Buffer;
import jakarta.servlet.ServletOutputStream;
Expand Down Expand Up @@ -233,4 +234,29 @@ public CompletableFuture<Void> sendPart(Part body) {
public CompletableFuture<Void> sendBuffer(Buffer buffer) {
throw new Error("not supported method");
}

@Override
public void sendRedirect(String location, boolean clearBuffer) throws IOException {
throw new Error("not supported method");
}

@Override
public void sendRedirect(String location, int statusCode) throws IOException {
throw new Error("not supported method");
}

@Override
public void sendRedirect(String location, int statusCode, boolean clearBuffer) throws IOException {
throw new Error("not supported method");
}

@Override
public void setTrailerFields(Supplier<Map<String, String>> supplier) {
throw new Error("not supported method");
}

@Override
public Supplier<Map<String, String>> getTrailerFields() {
throw new Error("not supported method");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

package org.apache.servicecomb.foundation.vertx.http;

import jakarta.servlet.http.HttpServletResponse;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -249,4 +250,34 @@ public void sendPart() {
Error error = Assertions.assertThrows(Error.class, () -> response.sendPart(null));
checkError(error);
}

@Test
public void testSendRedirectWithStatusCode() {
Error error = Assertions.assertThrows(Error.class, () -> response.sendRedirect("", HttpServletResponse.SC_ACCEPTED));
checkError(error);
}

@Test
public void testSendRedirectWithClearBuffer() {
Error error = Assertions.assertThrows(Error.class, () -> response.sendRedirect("", true));
checkError(error);
}

@Test
public void testSendRedirectWithStatusCodeAndClearBuffer() {
Error error = Assertions.assertThrows(Error.class, () -> response.sendRedirect("", HttpServletResponse.SC_ACCEPTED, true));
checkError(error);
}

@Test
public void testSetTrailerFields() {
Error error = Assertions.assertThrows(Error.class, () -> response.setTrailerFields(null));
checkError(error);
}

@Test
public void testGetTrailerFields() {
Error error = Assertions.assertThrows(Error.class, () -> response.getTrailerFields());
checkError(error);
}
}