Pergunta

Consider the following:

var params = Ext.urlDecode(window.location.search);
var store = Ext.getStore("EntryStore");
store.getProxy().extraParams={'mail':params.mail,'id':params.id};
store.load();

when called with localhost/mypage/?mail=test@mydomain.com&id=QWERTYUIOP/ASDFGHJKL456+yxcvbnm==
queries
localhost/api/?_dc=1387181002249&mail=test@mydomain.com&id=QWERTYUIOP/ASDFGHJKL456+yxcvbnm==&page=1&start=0&limit=25
which contains the reserved character "+" and makes the backend choke on that parameter.

(The C# WebApi backend tells me that the id is
QWERTYUIOP/ASDFGHJKL456 yxcvbnm==, as opposed to the original
QWERTYUIOP/ASDFGHJKL456+yxcvbnm==)

Is
(a) the unencoded "+" sign a bug in sencha or
(b) everything working as intended, and I should read the manual on how to encode my params (please provide a link, I don't find) or
(c) a bug on the Microsoft side causing WebApi to choke on the "+"?

Kind regards,

Alexander

Foi útil?

Solução

Query strings using the space character need it to be properly encoded. See this answer about that topic.

In short, it's not a bug in Sencha. It's not (necessarily) a bug in your API.

Considering you're using window.location.search to grab the querystring, the issue is that you got to that point without properly encoding the spaces.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top