DataFetching Flashcards

308A

1
Q

What does the readyState property of the XMLHttpRequest object indicate?

A

The state of the request (e.g., unsent, opened, done).

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

What can be used to intercept and modify requests or responses globally in Axios?

A

Interceptors

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

In Axios, how can you globally configure the default settings for requests?

A

axios.defaults

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

What is the primary way to handle the response from an Axios request?

A

Promises

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

Which of the following is a method in the XMLHttpRequest object for sending an HTTP request?

A

send()

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

How can you set custom headers for an Axios request?

A

By using the headers property in the config object.

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

Which method allows you to catch an error when using the fetch API?

A

catch()

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

What is a common use for the fetch API in modern JavaScript?

A

Making AJAX requests

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

Which of the following are methods on the Response object provided by the fetch API? Select all that apply.

A

text()
json()

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

If you want to make a POST request using the fetch API, what property would you need to set in the options object?

A

method

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

What does AJAX 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 of these is not a response method in Axios?

A

axios.data()

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

Which status code typically indicates a successful HTTP GET request?

A

200

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