HTTP & AJAX Flashcards

1
Q

What is a client?

A

A service requester.

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

What is a server?

A

A service provider.

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

The GET method

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

All HTTP requests and responses are composed of… (4)

A
  1. A start-line describing the requests to be implemented, or its status of success / failure.
  2. An optional set of HTTP headers specifying the request.
  3. A blank line indicating all meta-information has been sent.
  4. An option body containing data associated with the request or the document associated with 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 request message?

A
  1. An HTTP method, a verb (GET, PUT, POST) or a noun (HEAD, OPTIONS) that describes the action to be performed.
  2. The request target (often a URL) or the absolute path of the protocol port.
  3. The HTTP version, which defines the structure of the remaining message.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What three things are on the start-line of an HTTP response message?

A
  1. The protocol version (typically HTTP/1.1)
  2. A status code — indicating success or failure of the request. (200, 404, or 302 most common)
  3. A status text — brief purely information textual description of the status code.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What are HTTP headers?

A

Headers let the client and server pass additional information within an HTTP request / response

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

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

A

Nope!

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

What is AJAX?

A

A programming practice of building complex, dynamic webages using a techonolgy known as XMLHttpRequest

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

What does the AJAX acronym stand for?

A

Asynchronous Javascript and XML

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

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

A

XMLHttpRequest Object

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

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

A

Via prototypical inheritance!

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

What does fetch( ) return?

A

A pwomise.

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

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

A

GET

17
Q

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

A

Fetch optionally accepts a second params, an init object (usually named req) —> add the ‘method’ property with the desired method (GET, POST, etc.) as the value.