HTTP Flashcards
What is a client?
Clients send requests to servers. Clients Requests
What is a server?
Servers respond to request from clients. Servers Responses
Which HTTP method does a browser issue to a web server when you visit a URL?
GET method
What three things are on the start-line of an HTTP request message?
- An HTTP method, a verb (like GET, PUT or POST) or a noun (like HEAD or OPTIONS), that describes the action to be performed.
- The request target, usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context.
- The HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
What three things are on the start-line of an HTTP response message?
- The protocol version, usually HTTP/1.1.
- A status code, indicating success or failure of the request. Common status codes are 200, 404, or 302
- A status text. A brief, purely informational, textual description of the status code to help a human understand the HTTP message.
What are HTTP headers?
a place to send information between a request and a response.
Where would you go if you wanted to learn more about a specific HTTP Header?
MDN
Is a body required for a valid HTTP request or response message?
No, The final part of the request is its body. Not all requests have one: requests fetching resources, like GET, HEAD, DELETE, or OPTIONS, usually don’t need one. Some requests send data to the server in order to update it: as often the case with POST requests (containing HTML form data).
What is on the first line of an HTTP request message?
an http method, a request target, and the http version
What is on the first line of an HTTP response message?
the status code
What are HTTP headers?
a place to send information between a request and a response. Metadata.
Is a body required for a valid HTTP message?
No, The final part of the request is its body. Not all requests have one: requests fetching resources, like GET, HEAD, DELETE, or OPTIONS, usually don’t need one. Some requests send data to the server in order to update it: as often the case with POST requests (containing HTML form data).
What does fetch() return?
returns a promise that resolves with a Response object.
What is the default request method used by fetch()?
GET
How do you specify the request method (GET, POST, etc.) when calling fetch?
second arguemnt in a object {method: GET}