Question
· Mar 3, 2017

%request.Get() ignores characters in Base64 parameter [SOLVED]

Hi all,

I have the following problem with a WebApi that I've developed in EBS.

I have a GET method that reads the parameters and puts into a message to process.

Class MyApp.BS.ServiceRestBase Extends (%CSP.REST, Ens.BusinessService)


XData UrlMap [ XMLNamespace = "http://www.intersystems.com/urlmap]
{
<Routes>
<Route Url="/login" Method="GET" Call="Login"/>
</Routes>
}
/// Login
ClassMethod Login() As %Status
{

// Get the parameters
set login = %request.Get("login")
set password = %request.Get("password")
set app = %request.Get("app")
....

}

The password is a value in Base64, if I call the WebApi with the following URL it works

http://localhost:57772/MyApp/login?login=flopez@salutic.es&password=tpvkL8jiIFcpn15vIQdVwg==&app=MYAPP

however, the following one doesn't work

http://localhost:57772/MyApp/login?login=flopez@salutic.es&password=7d+rcUBPWF0wtMs4PHiluA==&app=MYAPP

When I've debuged the code, I've noted that the plus sign is replaces with a blank space, I don't know why, but its a problem because it uses the password to create a new URL and call to other WebApi, so it puts a blank space in the middle of the URL

Is there any way to gets the full parameter?

Maybe is due a charset or something in %request configuration.

Best regards,

Francisco

Discussion (2)0
Log in or sign up to continue

Solved...

I'm very sorry for this question, the answer was in my face and I didn't see it.

The plus sign is a special character in URL, so it should be replaced with "%2b" to escape the character.

I'm ashamed to think that this problem was too simple

I should call

http://localhost:57772/MyApp/login?login=flopez@salutic.es&password=7d%2brcUBPWF0wtMs4PHiluA==&app=MYAPP

Best regards,

Francisco