Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

spring boot get request body

public ResponseEntity<?> login(HttpServletRequest request) {
    String body = request.getReader().lines().collect(Collectors.joining(System.lineSeperator()));

    ObjectMapper mapper = new JsonMapper();
    JsonNode json = mapper.readTree(body);

    String email = json.get("email").asText();
    String password = json.get("password").asText();

    ...
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #spring #boot #request #body
ADD COMMENT
Topic
Name
3+9 =