I need to send a PUT or POST request to a url containing '%40' (encoded "@" symbol) in the destination url. I need to use the matlab.net.http send function in order to get information from the response headers.
I am not an expert on http. My problem is that regardless how I try to structure the message and send function, the sent request either includes the unencoded "@" symbol or the double-encoded '%2540', both of which trigger errors from the server.
Is there a way to force the send function to use '%40' in the destination address?
I am providing a dummy example below to show the issue because the real url (from Adobe API) is extremely long and contains API keys.
Grateful for any help on this.
exampleURL = 'https://www.example.com/abcd%40efgh.com/ijkl?queryString=queryValue';
exampleURL_components = URI(exampleURL,'literal');
exampleRequest = RequestMessage('PUT',[], "Irrelevant");
[~,sentrequest,~] = send(exampleRequest,exampleURL);
disp('Sent request contains double-encoding from @ to %2540');
disp(sentrequest.RequestLine.RequestTarget);
[~,sentrequest2,~] = send(exampleRequest,exampleURL_components);
disp('Sent request contains unencoded @');
disp(sentrequest2.RequestLine.RequestTarget);