3

I am using Angular2+ with in-memory-web-api and I am trying to do a simple query string. I am passing an exact email address to check if the user already exists. My createDB has a couple users with a propertyName of 'loginEmail' and these emails:

  • john@email.com
  • jane@email.com

The API URL looks like this:

api/accounts/?loginEmail=

If I pass:

john

I get one object to return. If I pass:

email.com

I get both objects to return. But, if I pass:

john@email.com or john@

I get 404 - Not Found

Does anyone know why this thing is bugging out on the @ character and how to get the in-memory-web-api to return an object correctly when passing an email address?

Thanks!

stupidFace
  • 181
  • 1
  • 8

1 Answers1

3

A few people helped me resolve this issue...

You can use the encodeURIComponent function on the email argument so the @ sign is returned correctly. I am using the string literal detailed below and it is now working correctly:

`${this.apiUrl}/?loginEmail=${encodeURIComponent(email)}`
stupidFace
  • 181
  • 1
  • 8