Query String Detection?

52 views
Skip to first unread message

jdandrea

unread,
Dec 6, 2010, 3:49:49 PM12/6/10
to GluePHP
I have a URL that supports GETs to search over a user account, as well
as POSTs to create for an account.

I'm thinking I want to use the same URL pattern. To allow for possible
query string params in the GET case (it's a search, after all), does
this make sense?

'/v1.0/(?P<username>[A-Za-z0-9_]+)/content/(\\?.+)?$'

Or is it more advisable to just break it into two patterns? (They're
so close otherwise, I thought it might be wise to consolidate ... but
maybe not.)

Joe

unread,
Dec 7, 2010, 4:14:11 PM12/7/10
to GluePHP
> I'm thinking I want to use the same URL pattern. To allow for possible
> query string params in the GET case (it's a search, after all), does
> this make sense?
>
>   '/v1.0/(?P<username>[A-Za-z0-9_]+)/content/(\\?.+)?$'
>
> Or is it more advisable to just break it into two patterns? (They're
> so close otherwise, I thought it might be wise to consolidate ... but
> maybe not.)

I think a decision like this is totally up to you -- whichever seems
more manageable. You could break it into two patterns and still point
to the same class, then use logic in the class to break it down
further. Or you could just use one big pattern and break the logic up
in the class, etc.

Joe
Reply all
Reply to author
Forward
0 new messages