Upon submitting a html form, method POST an uncalled GET request follows causing an error in my node JS http server, why is this redirect happening?

23 views Asked by At

I am running a node http server on Replit. The html page has a form element in it. The form's method is POST. When I click on the submit button 2 requests are made to the action. 1st the POST and then a GET with empty fields.

<form action="/example" method="post" enctype="multipart/form-data">...input elements...</form>

  • I have logged both a POST and then a GET method.

  • I have logged successful form-data in the POST request.

  • When the GET request is called the POST form-data is lost.

  • I don't want a global variable that captures the previous POST form-data and remembers it for the GET request because...

    1. I think it's an error, there shouldn't be any GET request to begin with.
    2. I want multiple users connected at a time.
0

There are 0 answers