INT-1082: Add tests for header expressions
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package org.springframework.integration.http;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertThat;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
@@ -25,8 +26,8 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.handler.ExpressionEvaluatingMessageProcessor;
|
||||
import org.springframework.mock.web.MockHttpServletRequest;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
@@ -111,4 +112,16 @@ public class DefaultInboundRequestMapperTests {
|
||||
tmpFile.deleteOnExit();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMessageWithDollar() throws Exception {
|
||||
MockHttpServletRequest request = new MockHttpServletRequest();
|
||||
request.setContentType("text");
|
||||
request.setCharacterEncoding("utf-8");
|
||||
byte[] bytes = SIMPLE_STRING.getBytes("utf-8");
|
||||
request.setContent(bytes);
|
||||
Message<String> message = (Message<String>) mapper.toMessage(request);
|
||||
ExpressionEvaluatingMessageProcessor processor = new ExpressionEvaluatingMessageProcessor("headers['$http_requestUrl']");
|
||||
assertEquals(message.getHeaders().get(HttpHeaders.REQUEST_URL), processor.processMessage(message));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,6 @@ import org.easymock.IAnswer;
|
||||
import org.easymock.classextension.ConstructorArgs;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.integration.core.Message;
|
||||
import org.springframework.integration.core.MessageChannel;
|
||||
import org.springframework.integration.core.MessageHeaders;
|
||||
|
||||
Reference in New Issue
Block a user