List of usage examples for org.springframework.web.server ServerWebExchange getFormData
Mono<MultiValueMap<String, String>> getFormData();
From source file:org.springframework.cloud.gateway.test.HttpBinCompatibleController.java
@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<>(); ret.put("headers", getHeaders(exchange)); ret.put("data", body); HashMap<String, Object> form = new HashMap<>(); ret.put("form", form); return exchange.getFormData().flatMap(map -> { for (Map.Entry<String, List<String>> entry : map.entrySet()) { for (String value : entry.getValue()) { form.put(entry.getKey(), value); }/*from ww w. j ava2s . c o m*/ } return Mono.just(ret); }); }