Pregunta

@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?

¿Fue útil?

Solución

You should encode your string in frontend for example using encodeURIComponent

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top