I have the following extremely simple SpringBoot program
// APIEndpoints.java
// Imports!
public class APIEndpoints {
@PostMapping("deduplicate")
public String deduplicate(@RequestParam(value = "data") String data) {
return data;
}
}
// RestServiceApplication.java
@SpringBootApplication
public class RestServiceApplication {
public static void main(String[] args) throws SQLException {
SpringApplication.run(RestServiceApplication.class, args);
}
}
I can start the springboot server via ./gradlew bootRun
, and have verified that the server is working through other endpoints.
Here is my issue: using postman to send a post request, the following goes off without a hitch
localhost:8080/deduplicate?data=1,23,4,5
However, this one fails with an error: "HTTP 400: Bad Request"
localhost:8080/deduplicate?data=[1,23,4,5]
This seems like undesirable behavior, and it doesn't seem to be a fundamental limitation of url formatting or anything like that.
What is causing this error, and how can I set up Spring Boot to accept lists enclosed in brackets?