Networking/http Flashcards

1
Q

What is a client?

A

A piece of computer hardware or software that accesses a service made available by a server.

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

What is a server?

A

A piece of computer hardware or software (computer program) that provides functionality for other programs or devices, called “clients”

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 method

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 (GET, PUT, POST, HEAD, OPTIONS… etc)
  2. The request target, usually a URL
  3. The HTTP version, which defines the structure of the remaining message acting as an indication 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.
  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

HTTP headers let the client and the server pass additional information with an HTTP request or response

HTTP headers specify the request, or describing the body included in the message. Additional information about the request itself.

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

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

A

A body is optional, though frequent for responses.

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

What is the significance of an HTTP request’s method?

A

Request methods indicate the desired action to be performed for a given resource.
The request method is about expressing intent but it is arbitrary - it is up to the server to provide a response and it does not have to related to the request.

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

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

A

By adding a method property to the options object passed in as the second argument to the request. (the first being the request target)
e.g: fetch( ‘https://pokeapi.co/api/v2/pokemon/pikachu’, { method: ‘GET’
} )

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

What does response.json do?

A

The json( ) method of the body mixin take a Response stream and reads it to completion and pareses the body text as JSON

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