HTTP Flashcards

1
Q

What is a client?

A

service or resource requester that receives info from a server

ex/ browser

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a server?

A

handles requests from client

will provide resource or service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What three things are on the START LINE of an HTTP request message?

A

MTV
method, target, version

  1. HTTP method that describes action to be performed ex/ (GET, PUT, POST) or (HEAD, OPTIONS)
  2. request target, usually a URL or absolute path
  3. HTTP version
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What three things are on the START LINE of an HTTP response message?

A

VCS
version, code, text

  1. protocol version
  2. status code for success or fail
  3. status text
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are HTTP headers?

A

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)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where would you go if you wanted to learn more about a specific HTTP Header?

A

MDN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Is a body required for a valid HTTP request or response message?

A

no

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is on the first line of an HTTP response message?

A
  • response status of success/failure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What does fetch() return?

A

returns a Promise so you can use the then() and catch() methods to handle it:

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is the default request method used by fetch()?

A

GET

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How do you specify the request method (GET, POST, etc.) when calling fetch?

A

2nd arg as object, set method as string

fetch(‘https://example.com/profile’, {
method: ‘POST’, // or ‘PUT’
})

How well did you know this?
1
Not at all
2
3
4
5
Perfectly