0

I am trying to send any valid URL string as a request parameter in a GET request. For example, sending a GET request with the following query string format /?link=https://google.co.uk should provide me with https://google.co.uk in a string on the server-side. Using ASP.NET Core for context.

This seems to work fine when using fairly basic URLs as above. But breaks when using more complex ones. Below is an example URL that does not get properly recieved.

http://scholar.google.co.uk/scholar_url?url=https%3A%2F%2Fwww.tandfonline.com%2Fdoi%2Fabs%2F10.1080%2F17437270701207868&hl=en&sa=T&ct=res&cd=0&d=632494701696987026&ei=vexFXJG5HJKemQHOwZm4Dg&scisig=AAGBfm09UcpdRzVcZmsAUFlIsO_k9li8HQ&nossl=1&ws=1920x1024&at=Ethical%20issues%20in%20online%20educational%20research%3A%20protecting%20privacy%2C%20establishing%20authenticity%20in%20email%20interviewing

When sent in a GET request with the same format as above, via Javascript's Fetch API the following is recieved on the server:

http://scholar.google.co.uk/scholar_url?url=https%3a%2f%2fwww.tandfonline.com%2fdoi%2fabs%2f10.1080%2f17437270701207868

This appears to cut off after the & even using encodeURI. I have verified that I get the correct string on the server when sending via POST instead, but using POST would not be REST compliant for my case.

I need a way of escaping any & or other special characters that may cause similar behaviour when sending a string as a GET request parameter. Is there any best practice for dealing with this kind of situation?

Jack
  • 391
  • 5
  • 25

0 Answers0