3
url=`https://xxxxxxxxxxx.com/HiThere/${firstName}|${lastName}`

I'm passing this but during request its changing to https://xxxxxxxxxxx.com/HiThere/${firstName}%7C${lastName}

phuclv
  • 37,963
  • 15
  • 156
  • 475
Ajay
  • 31
  • 1
  • 2
  • 1
    send it as `%7C` then! `url=https://xxxxxxxxxxx.com/HiThere/${firstName}%7C${lastName}` – Dane Apr 26 '18 at 04:05
  • 1
    Possible duplicate of [How to handle escape characters (pipe |) in URL (Spring, REST, CXF)?](https://stackoverflow.com/questions/21940826/how-to-handle-escape-characters-pipe-in-url-spring-rest-cxf) – Dane Apr 26 '18 at 04:06

2 Answers2

2

How to pass “|” symbol in Axios URL?

Be certain that you are getting it correctly, and not converting it.

See: How to prevent Axios from encoding my request parameters?, Getting Started With Axios, or Get parameter array with key value.

The "encoding" ought to be done in the standard manner, it's up to the decoder to 'do the right thing'.

See: HTML URL Encoding Reference - W3Schools, URL Encoding | Maps URLs | Google Developers or Google fonts URL break HTML5 Validation on w3.org.

The pipe is encoded as: %7C

Rob
  • 1,487
  • 2
  • 25
  • 29
1

You cannot use < > # % { } | \ ^ ~ [ ] characters in a url safely. Please check this link for more information regarding which all characters can be used safely. So either you have to change the symbol or decode the '%7C'.

Rohith Murali
  • 5,551
  • 2
  • 25
  • 26