Search in sources :

Example 1 with CaseInsensitiveHashMap

use of com.blade.kit.CaseInsensitiveHashMap in project blade by biezhi.

the class HttpRequestTest method testHeaders.

@Test
public void testHeaders() {
    Request mockRequest = mockHttpRequest("GET");
    Map<String, String> headers = new CaseInsensitiveHashMap<>();
    headers.put("h1", "a1");
    headers.put("H2", "a2");
    when(mockRequest.headers()).thenReturn(headers);
    Request request = new HttpRequest(mockRequest);
    assertEquals("a1", request.header("h1"));
    assertEquals("a1", request.header("H1"));
    assertEquals("a2", request.header("h2"));
    assertEquals("a2", request.header("H2"));
    request.headers().forEach((key, val) -> System.out.println(key + "\t=\t" + val));
}
Also used : HttpRequest(com.blade.mvc.http.HttpRequest) HttpRequest(com.blade.mvc.http.HttpRequest) Request(com.blade.mvc.http.Request) CaseInsensitiveHashMap(com.blade.kit.CaseInsensitiveHashMap) Test(org.junit.Test)

Aggregations

CaseInsensitiveHashMap (com.blade.kit.CaseInsensitiveHashMap)1 HttpRequest (com.blade.mvc.http.HttpRequest)1 Request (com.blade.mvc.http.Request)1 Test (org.junit.Test)1