formatting

This commit is contained in:
Spencer Gibb
2020-03-02 20:02:08 -05:00
parent 3d278e93d2
commit 52c3fd97fe
3 changed files with 18 additions and 12 deletions

View File

@@ -63,16 +63,17 @@ public class HttpBinCompatibleController {
return "httpbin compatible home";
}
@RequestMapping(path = "/headers", method = { RequestMethod.GET,
RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/headers", method = { RequestMethod.GET, RequestMethod.POST },
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> headers(ServerWebExchange exchange) {
Map<String, Object> result = new HashMap<>();
result.put("headers", getHeaders(exchange));
return result;
}
@RequestMapping(path = "/multivalueheaders", method = { RequestMethod.GET,
RequestMethod.POST }, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/multivalueheaders",
method = { RequestMethod.GET, RequestMethod.POST },
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> multiValueHeaders(ServerWebExchange exchange) {
Map<String, Object> result = new HashMap<>();
result.put("headers", exchange.getRequest().getHeaders());
@@ -86,7 +87,8 @@ public class HttpBinCompatibleController {
return Mono.just(get(exchange)).delayElement(Duration.ofSeconds(delay));
}
@RequestMapping(path = "/anything/{anything}", produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/anything/{anything}",
produces = MediaType.APPLICATION_JSON_VALUE)
public Map<String, Object> anything(ServerWebExchange exchange,
@PathVariable(required = false) String anything) {
return get(exchange);
@@ -107,7 +109,8 @@ public class HttpBinCompatibleController {
return result;
}
@RequestMapping(value = "/post", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(value = "/post", consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<Map<String, Object>> postFormData(
@RequestBody Mono<MultiValueMap<String, Part>> parts) {
// StringDecoder decoder = StringDecoder.allMimeTypes(true);
@@ -123,13 +126,16 @@ public class HttpBinCompatibleController {
}).map(files -> Collections.singletonMap("files", files));
}
@RequestMapping(path = "/post", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/post",
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<Map<String, Object>> postUrlEncoded(ServerWebExchange exchange)
throws IOException {
return post(exchange, null);
}
@RequestMapping(path = "/post", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
@RequestMapping(path = "/post", method = RequestMethod.POST,
produces = MediaType.APPLICATION_JSON_VALUE)
public Mono<Map<String, Object>> post(ServerWebExchange exchange,
@RequestBody(required = false) String body) throws IOException {
HashMap<String, Object> ret = new HashMap<>();

View File

@@ -55,8 +55,8 @@ import org.springframework.web.util.UriComponentsBuilder;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(properties = {
"spring.cloud.gateway.proxy.auto-forward=baz" }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(properties = { "spring.cloud.gateway.proxy.auto-forward=baz" },
webEnvironment = WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = TestApplication.class)
public class ProductionConfigurationTests {

View File

@@ -58,8 +58,8 @@ import org.springframework.web.util.UriComponentsBuilder;
import static org.assertj.core.api.Assertions.assertThat;
@RunWith(SpringRunner.class)
@SpringBootTest(properties = {
"spring.cloud.gateway.proxy.auto-forward=baz" }, webEnvironment = WebEnvironment.RANDOM_PORT)
@SpringBootTest(properties = { "spring.cloud.gateway.proxy.auto-forward=baz" },
webEnvironment = WebEnvironment.RANDOM_PORT)
@ContextConfiguration(classes = TestApplication.class)
@DirtiesContext
public class ProductionConfigurationTests {