Home > Articles

  • Print
  • + Share This
This chapter is from the book

Workshop

The workshop contains quiz questions and exercises to help you solidify your understanding of the material covered. Try to answer all questions before looking at the “Answers” section that follows.

Quiz

1. What is the difference between an HTTP GET and a POST request?

2. In a handler function, what does w.Write do in terms of processing the response where w is a ResponseWriter?

3. Should you trust data submitted to an HTTP server?

Answers

1. A GET request requests data from a specified resource. A POST request submits data to a specified resource. A GET request may set data through query string parameters. A POST request sends data to the server as the message body.

2. Calling Write on a ResponseWriter causes the response to be sent to the client. This includes headers and the body content. Once sent, it is not possible to modify the response.

3. No. You should never trust data submitted by a client to a server. Data should be sanitized before use.

  • + Share This
  • 🔖 Save To Your Account