mosesajire / pi-generator

This is a PHP program that generates the value of Pi to the nth digit.
0 stars 0 forks source link

Submitting a post request via post man will raise an error. #1

Open uncle-tee opened 7 years ago

uncle-tee commented 7 years ago

Try building test cases and test your cases via post man to the URL. You have only used the front end to restrict parsing in a string. Imagine a user passes the parameters to the URL directly.

mosesajire commented 7 years ago

Okay, thanks.

Do you mean that I should create something like an API which can be tested using postman?

As it is currently, submission of a post request through the 'submit' button will result in no error because the chosen method for the form is 'POST'.

Yes, you are right. I have used the frontend to restrict parsing in a string, but I also used is_numeric(...) to validate the input and ensure that it is a number at the backend.

With the 'POST' method, the user will not be able to pass parameter to the URL directly. However, changing the method of the form to 'GET' will make it possible for parameters to be passed to the URL directly.

Thanks and regards.

uncle-tee commented 7 years ago

I was only saying you should test your code via post postman but it seems to be cleaner now. Your code is still failing a test case. I will not tell you the case. Please look look out for it. Let me know if you do not identify the case.

mosesajire commented 7 years ago

I think I have identified it. Please check out the updated code. Thanks.