What Happens When a Client Sends a Request to the Server

Introduction 
 
In today's world, we take the web for granted. When we open up the browser and go to a webpage, we expect it to just open up and work.
 
But what's going on the background is a black box, with a lot of things happening but the type of calls that are being made actually quite simple.
 
Let's talk about what happens when we make these sorts of requests. 
 
When a client of some goes on a laptop and types www.google.com, it is going to make a request to some remote server, which is actually a text document.
 
what happens when client sends request to server
This document contains three pieces of items, as below:
  • Verb
  • Headers
  • Content 
Verbs are the actions that we want to perform on the server. This is the short work that says please do something for me and will define it by the name of the work.
 
what happens when client sends request to server
 

Http Verbs/Actions

  • GET: Fetches/Request Resource
  • POST: Creates/Inserts Resource
  • PUT: Updates/Modifies Resource
  • PATCH: Updates/Modifies Partial Resource
  • DELETE: Deletes/Remove Resource
Headers are a set of name-value pairs which contain metadata about the request.
 
what happens when client sends request to server
 

Request's Metadata

  • CONTENT TYPE: What type of content is the content section holding.It tells the server on how to deal with the request.
  • CONTENT LENGTH: This is a hint to the size of content that is there.
  • AUTHORIZATION: Contains the credentials to authenticate a user agent with a server.
  • ACCEPT: It can be used to specify certain media types which are acceptable for the response.
If we are looking at a webpage you're going to request, it's normally going to return an HTML page. That HTML might have CSS/javascript or JSON in the request.
 
what happens when client sends request to server
 

Conclusion

 
This is how things run in the background when a request initiated, thus the brief overview of Request Object. Happy Learning :)


Similar Articles