O'Reilly logo

Go Web Development Cookbook by Arpit Aggarwal

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works…

Once we run the program, the HTTP server will start locally listening on port 8443.

Next, execute a POST request from the command line as:

$ curl -X POST --data "name=Foo&email=aggarwalarpit.89@gmail.com" https://localhost:8443/post --insecure

It will give you the Forbidden - CSRF token invalid message as a response from the server and forbids you to submit an HTML form because the server does not find a valid CSRF token as part of the request:

So, to submit a form, firstly we have to sign up, which generates a valid CSRF token by executing the following command:

$ curl -i -X GET https://localhost:8443/signup --insecure

This ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required