@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2023-2023 the original author or authors.
|
* Copyright 2023-2025 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -727,7 +727,7 @@ public class ServerlessHttpServletRequest implements HttpServletRequest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setHeader(String name, @Nullable String value) {
|
public void setHeader(String name, @Nullable String value) {
|
||||||
this.headers.set(name, value);
|
this.headers.add(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addHeader(String name, @Nullable String value) {
|
public void addHeader(String name, @Nullable String value) {
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import org.springframework.cloud.function.test.app.Pet;
|
|||||||
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig;
|
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig;
|
||||||
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig.AnotherFilter;
|
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig.AnotherFilter;
|
||||||
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig.SimpleFilter;
|
import org.springframework.cloud.function.test.app.PetStoreSpringAppConfig.SimpleFilter;
|
||||||
|
import org.springframework.http.HttpHeaders;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
@@ -57,6 +58,18 @@ public class RequestResponseTests {
|
|||||||
this.mvc.stop();
|
this.mvc.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void validateCaseInsensitiveHeaders() throws Exception {
|
||||||
|
ServerlessHttpServletRequest request = new ServerlessHttpServletRequest(null, "GET", "/index");
|
||||||
|
request.setHeader("User-Agent", "iOS");
|
||||||
|
request.setHeader("uSer-Agent", "FOO");
|
||||||
|
request.setContentType("application/json");
|
||||||
|
request.setHeader("CoNteNt-tYpe", "text/plain");
|
||||||
|
|
||||||
|
assertThat(request.getHeader("content-TYPE")).isEqualTo("application/json");
|
||||||
|
assertThat(request.getHeader("user-agenT")).isEqualTo("iOS");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void validateFreemarker() throws Exception {
|
public void validateFreemarker() throws Exception {
|
||||||
HttpServletRequest request = new ServerlessHttpServletRequest(null, "GET", "/index");
|
HttpServletRequest request = new ServerlessHttpServletRequest(null, "GET", "/index");
|
||||||
|
|||||||
Reference in New Issue
Block a user