HTTP Flashcards
What is a client?
service or resource requester that receives info from a server
ex/ browser
What is a server?
handles requests from client
will provide resource or service
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
What three things are on the START LINE of an HTTP request message?
MTV
method, target, version
- HTTP method that describes action to be performed ex/ (GET, PUT, POST) or (HEAD, OPTIONS)
- request target, usually a URL or absolute path
- HTTP version
What three things are on the START LINE of an HTTP response message?
VCS
version, code, text
- protocol version
- status code for success or fail
- status text
What are HTTP headers?
ways of passing additional info btwn server and client as needed
GRR
Request Headers:
- general (apply to msg as whole)
- request headers (modify request with specifics)
- representation headers (describe original format and encoding)
Response headers:
- general (apply to msg as whole)
- response headers (give additional info about server)
- representation headers (describe adddtl format and encoding)
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
What is on the first line of an HTTP response message?
- response status of success/failure
What does fetch() return?
returns a Promise so you can use the then() and catch() methods to handle it:
What is the default request method used by fetch()?
GET
How do you specify the request method (GET, POST, etc.) when calling fetch?
2nd arg as object, set method as string
fetch(‘https://example.com/profile’, {
method: ‘POST’, // or ‘PUT’
})