Pabe1975
5 years agoOccasional Contributor
Replacing + character with %2B when sending
When sending a http request with a + in the a field (in this case a field that contains an international phone number with + XX XXXX) the + is replaced with a space.
However in the receiving endpoint needs the +, is there a way to replace the + with %2B so a + character is sent to the receiver ?
We don't want the %2B in the field as it confuses people so we want to handle this issue 'behind the screens'.
- You may use Events feature beforeSubmit method and conditionally replace the value.
- Hi Pabe1975,
Rao's correct (as always), but your + character is being encoded (percent/html encoding) to %2B.
This is standard html encoding that occurs in all HTTP requests (Rest and Soap), so if an endpoint is struggling with the encoding, especially as you state that the %2B is being replaced by a space character instead, i'd suggest this is a defect and your developers need to be aware of this. Mention percent/html encoding and theyll know what youre talking about.
If you want to disable the percent encoding there is a checkbox entitled 'Disable encoding' which is available in the 'Advanced options' available at 'Request' level in the Projects section of ReadyAPI!.
Just an alternative option to Raos.
Nice one
Rich