forked from vert-x3/vertx-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE in ForwardedParser#authority() vert-x3#2629
- Loading branch information
Showing
2 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
vertx-web/src/test/java/io/vertx/ext/web/impl/HttpServerRequestWrapperTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package io.vertx.ext.web.impl; | ||
|
||
import io.vertx.core.http.HttpServerRequest; | ||
import io.vertx.core.http.impl.HttpServerRequestInternal; | ||
import io.vertx.ext.web.AllowForwardHeaders; | ||
import org.junit.Test; | ||
|
||
import static org.junit.Assert.assertNull; | ||
import static org.mockito.Mockito.mock; | ||
|
||
public class HttpServerRequestWrapperTest { | ||
|
||
@Test | ||
public void test_authority_can_be_null() { | ||
HttpServerRequest request = mock(HttpServerRequestInternal.class); | ||
HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request, AllowForwardHeaders.NONE); | ||
assertNull(request.authority()); | ||
assertNull(wrapper.authority()); | ||
} | ||
|
||
@Test | ||
public void test_scheme_can_be_null() { | ||
HttpServerRequest request = mock(HttpServerRequestInternal.class); | ||
HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request, AllowForwardHeaders.NONE); | ||
assertNull(request.scheme()); | ||
assertNull(wrapper.scheme()); | ||
} | ||
|
||
@Test | ||
public void test_path_can_be_null() { | ||
HttpServerRequest request = mock(HttpServerRequestInternal.class); | ||
HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request, AllowForwardHeaders.NONE); | ||
assertNull(request.path()); | ||
assertNull(wrapper.path()); | ||
} | ||
|
||
@Test | ||
public void test_query_can_be_null() { | ||
HttpServerRequest request = mock(HttpServerRequestInternal.class); | ||
HttpServerRequestWrapper wrapper = new HttpServerRequestWrapper(request, AllowForwardHeaders.NONE); | ||
assertNull(request.query()); | ||
assertNull(wrapper.query()); | ||
} | ||
} | ||
|