Search code examples
angulargeturibackend

Handling URI reserved characters for GET requests


I'm making GET requests from my angular service by replacing reserved characters using encodeURIComponent so that it is sent to URL like

http://localhost:4200/api/verifiers/https%3A%2F%2Fwww.web.com%2Fdev%2F0/services/xx%3Ayy%3AV00000000000000000000000000000000000000000000000000000000000000000000000000000000%23read-device

However when my FastAPI backend receive the request it will display a 404 Not Found error because some characters like %2F are recognized as / so the controller fails at parsing the URL related to the method that should handle the request.

For example the above URL is received from my backend as

/verifiers/https%3A//www.web.com/dev/0/services/xx%3Ayy%3AV00000000000000000000000000000000000000000000000000000000000000000000000000000000%23read-device

Solution

  • Solved by postfixing :path in the URL path of the handlers