-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/smartystreets/smartystree…
…ts-java-sdk into eric/compatibility-parameter
- Loading branch information
Showing
3 changed files
with
69 additions
and
18 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
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
29 changes: 29 additions & 0 deletions
29
src/test/java/com/smartystreets/api/XForwardedForTest.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,29 @@ | ||
package com.smartystreets.api; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertNotNull; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.junit.Test; | ||
|
||
import com.smartystreets.api.mocks.RequestCapturingSender; | ||
|
||
public class XForwardedForTest { | ||
@Test | ||
public void testAllCustomHeadersAreAddedToTheRequest() throws Exception { | ||
HashMap<String, Object> headers = new HashMap<>(); | ||
headers.put("X-Forwarded-For", "ip"); | ||
RequestCapturingSender inner = new RequestCapturingSender(); | ||
CustomHeaderSender sender = new CustomHeaderSender(headers, inner); | ||
Request request = new Request(); | ||
|
||
sender.send(request); | ||
|
||
Map<String, Object> requestHeaders = inner.getRequest().getHeaders(); | ||
assertNotNull("Headers here.", requestHeaders); | ||
assertEquals(headers.get("X-Forwarded-For"), inner.getRequest().getHeaders().get("X-Forwarded-For")); | ||
|
||
} | ||
} |