1

I am having a problem with passing emails in http url using spring. My url looks as follows

http://localhost:8080/users/{email}

I am using spring mvc to handle this GET request.

Using my browser url bar or using Postman when I do the following

http://localhost:8080/users/sampleEmail@gmail.com

I only see sampleEmail@gmail in the spring controller code. For some reason the ".com" part is stripped out. Would anyone know if I am doing something wrong? Thanks

Abdul Rahman
  • 1,294
  • 22
  • 41

1 Answers1

2

It is because Spring truncates whatever is coming after DOT(.) assuming it to be an extension.

Refer this: Spring MVC @PathVariable with dot (.) is getting truncated

Is there a requirement that you need to use only GET? If not then switch to POST and send JSON Object with required parameters such as {email: "abc@xyz.com"}

Community
  • 1
  • 1
user2004685
  • 9,548
  • 5
  • 37
  • 54