Frage

I am trying to send a parameter after convert it to the base 64 the definition of the geddy.js route :

router.get(routing_prefix+'/gogetthecart/:data').to('Main.gogetthecart');

In the client side, javascript, I generate a base64 json data var jsonb64 = btoa(JSON.stringify(params)); after that I call the url that will somthing like this

http://www.mydomain.com//gogetthecart/GVudGl...aWNo=

I got Error: 404 Not Found.. But If I delete manually the = from the end of data that work

War es hilfreich?

Lösung

Solved by the community in the git repos issues https://github.com/geddy/geddy/issues/556 as Kieran said

I looked into adding support for base64 encoded vars to Barista directly, but some characters in the b64 spec are reserved in the URI spec. I don't feel comfortable making that the default behaviour.

However! You can simply override the behaviour to support this use case:

router
.get( routing_prefix+'/gogetthecart/:data')
.to('Main.gogetthecart')
.where({
  data: /[\w\-\/+]+={0,2}/ // base64-safe regex condition
})

and that should do the trick!

I added a test here: https://github.com/kieran/barista/blob/master/tests/barista.test.js#L812

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top