HTTP Flashcards

1
Q

What is a client?

A

A service requester who initiates communication sessions with servers, which await incoming requests. A client requests content or service from a server.

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

What is a server?

A

The provider of a resource or service. A server host runs one or more server programs, which share their resources with clients. Servers await incoming requests.

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
  1. An HTTP method that describes the action to be performed: a verb (like GET, PUT, or POST) or a noun (like HEAD or OPTIONS).
  2. The request target, usually a URL, or the absolute path of the protocol, port, and domain are usually characterized by the request context. The format of this request target varies between different HTTP methods.
  3. The HTTP version, which defines the structure of the remaining message, acting as an indicator of the expected version to use for the response.
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
  1. The protocol version, usually HTTP/1.1.
  2. A status code, indicating success or failure of the request. Common status codes are 200, 404, or 302
  3. A status text. A brief, purely informational, textual description of the status code to help a human understand the HTTP message.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are HTTP headers?

A

An HTTP header is a field of an HTTP request or response that passes additional context and metadata about the request or response.

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

A body is optional. It contains data associated with the request or the document associated with a response. The body refers to the payload of the HTTP message

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

What is AJAX?

A

An asynchronous technique for loading data into part of a page without having to refresh the entire page. It allows you to request data from a server and load it without having to refresh the entire page.

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

What does the AJAX acronym stand for?

A

Historically, AJAX was an acronym for the technologies used in asynchronous requests and stood for Asynchronous JavaScript And XML, but since then, technologies have moved on and now the term is used to refer to a group of technologies that offer asynchronous functionality in the browser.

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

Which object is built into the browser for making HTTP requests in JavaScript?

A

The XMLHttpRequest object.

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

What event is fired by XMLHttpRequest objects when they are finished loading the data from the server?

A

The ‘load’ event

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

An XMLHttpRequest object has an addEventListener() method just like DOM elements. How is it possible that they both share this functionality?

A

They both share a prototype somewhere in their prototype chain. The EventTarget prototype. Prototypal inheritance.

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

What does fetch() return?

A

A Promise that resolves to a Response object.

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

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

A

method: “GET”

17
Q

How does fetch report errors?

A

A then() handler must check the Response.ok and/or Response.status properties.