Question

@RequestMapping(value = {"/hello"}, method = RequestMethod.GET)
@ResponseBody
public ResponseEntity<String> getContent(@RequestParam(value = "url", required = true) String url) {
    System.out.println("My passed url is: " + url);
}

When I do

curl "localhost:8080/hello?url=http://www.test.com/boom/4?utm_source=Google+Places&utm_medium=LLM&utm_campaign=DAC+LLM"

The url I'm trying to pass as a GET parameter gets truncated at the & sign because it thinks it's the start of another GET parameter.

My passed url is http://www.test.com/boom/4?utm_source=Google+Places

Any way to get around this, or should I change from GET to POST?

Was it helpful?

Solution

You should encode your string in frontend for example using encodeURIComponent

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top