0

I have a field that I can insert a certain name and find the user with the correspondent name,that was developed in react. My code works when that name is like "test", but if the name is like "this test" (if the name has a space on it), my backend receives the name in this format ("this%20test") and when I am searching for that name on the database, the entry returns null. How can I solve this? I want to solve this on my frontend because I think it´s the best option.

jose azevedo
  • 245
  • 2
  • 3
  • 19

1 Answers1

1

Any parameters passed as query params will be url-encoded and passed to your backend. You need to url decode parameters in your backend.

See this to url decode in java https://stackoverflow.com/a/6138183/3295987

Hemant Patel
  • 3,160
  • 1
  • 20
  • 29
  • I have a similar problem in react,I have a card componet and the card has a button.If the name of the card doesn´t have a space on it a popup will open (which is supposed to) but if the name has a space on it,the popup won´t open,can I update my question so you can help me on that? – jose azevedo Mar 30 '19 at 19:07
  • It seems another problem, post it as another question. – Hemant Patel Mar 30 '19 at 19:08
  • Thanks nonetheless! – jose azevedo Mar 30 '19 at 19:10