alexandernst
alexandernst

Reputation: 15099

RedirectRoute in Google App Engine and url arguments

I have a RESTful API like /do/some/<action:.*> so my app with get <action> and run it.

My question is, if I use RedirectRoute and strict_slash=True, will my app keep getting <action> as argument or will it start getting <action>/ (notice the / at the end)?

EDIT: I'm using webapp2

Upvotes: 1

Views: 168

Answers (1)

Murph
Murph

Reputation: 1509

A RedirectRoute will issue a HTTP redirect telling the browser to go to the new URL, then the browser will make a new request at that URL.

How this is implemented is that two routes are created - your original route, and one for redirecting.

So, in your case, a route with /do/some/<action:.*>/ would be created that redirects to /do/some/<action.*>.

However, I think your route actually will be checked first (not positive, sorry), so it would just always fire. I would modify it to not match slashes, if that's okay. Luckily, that's the default behaviour if you omit the regex, so just /do/some/<action:> should work!

Upvotes: 1

Related Questions