Handling complex GET parameters with Slim Framework HTTP Routing

Assuming the following naive code:

$app->get( '(/store(/:url)+)', function( $url = NULL ) use ( $app ) { // Execute actions on $url }); 

The above works great for the following:

 http://localhost/api/0001/store/url-data 

But this fails for:

 http://localhost/api/0001/store/http%3A%2F%2Fexample.com%2FSomething http://localhost/api/0001/store/http://example.com/Something // and other variations 

I want to pass the full encoded URI for server side processing. How can I do this with Slim?

Notes:

Other types of HTTP requests (POST, PUT) will not work for this problem.

It can be resolved at the other end by reformatting (serializing) the URI, but I want this to be my last resort.

Important editing is the answer

Thus, the above is a mistake in the framework, which is currently being tested and, hopefully, fixed and released in the near future. I solved the problem temporarily by serializing the URI before it reaches the server side.

+6
source share
1 answer

Thus, the above is a mistake in the framework, which is currently being tested and, hopefully, fixed and released in the near future. I solved the problem temporarily by serializing the URI before it reaches the server side.

0
source

Source: https://habr.com/ru/post/946543/


All Articles