mardi 3 mars 2020

Post API breaks with long parameter values

I have a Laravel 5.7 backend that receives API calls generally fine. However I am trying to pass a long base64 string as a post request (testing in postman) and strange things are happening.

Post URL is: http://localhost:8000/api/group/uploadGroupImage?group_id=1&input_img=data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAIQAABtbnRy... (Abbreviated )

No Specific headers set apart from authentication

If the length of the input_img value is short the post works fine. However if it's more than about 15,000 characters, the response from laravel is:

"exception": "Symfony\\Component\\HttpKernel\\Exception\\NotFoundHttpException",
"file": "/Users/myuser/Sites/laravel/fxdoc/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php",
"line": 179,

And if the string gets up to more than 100,000 characters then I get (in postman):

Could not get any response
There was an error connecting to http://localhost:8000/api/group/uploadGroupImage?group_id=1&input_img=data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/4gIoSUNDX1BST0ZJTEUAAQEAAAIYAAAAAAIQAABtbnRy... (Abbreviated )
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General

(this can be the response within a few seconds sometimes)

In postman I've turned off all proxy and SSL options (Backend is definitely working as it works for short values) and timeout is set to 0 (no timeout)

Can anyone help me? Literally the only difference between it working and breaking is the length of the parameter value.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire