S
S
Savant92015-12-05 23:43:11
Ruby on Rails
Savant9, 2015-12-05 23:43:11

How to configure routing to accept a long value?

There is a routing:

match 'new_user/registration_id/:registration_id/domain_name/:domain/platform/:platform' => 'notification#do_subscribe', :via => [:get], :constraints  => { :domain => /[0-z\.]+/, :registration_id => /.*/ }

The biggest problem is with the registration_id value. It's not me who generates it, there can be a # symbol and anything. And it's a very long value. It works for me on some standard values, but in 99% of cases - there is no such routing error.
I send it from the client:
var xmlHttp = new XMLHttpRequest();
  xmlHttp.open('GET', 'https://www.url.com/do_subscribe/notification_api/registration_id/' + subscriptionId + '/domain_name/' +
               domainName + '/platform/' + platform, false);

Maybe somehow it is not necessary to send it.
Thanks to all.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
moondog, 2015-12-06
@Savant9

need encodeUriComponent(subscriptionId). Well, for all other parameters, it also does not hurt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question