0
0
Rest APIprogramming~10 mins

Response headers (Cache-Control, ETag) in Rest API - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to set the Cache-Control header to no-cache.

Rest API
response.headers['Cache-Control'] = '[1]'
Drag options to blanks, or click blank then click option'
Ano-cache
Bmax-age=3600
Cprivate
Dpublic
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'max-age=3600' which allows caching for 1 hour.
Using 'public' which allows caching by any cache.
2fill in blank
medium

Complete the code to set the ETag header with a unique identifier.

Rest API
response.headers['ETag'] = '[1]'
Drag options to blanks, or click blank then click option'
A12345
B"12345"
Cetag_value
D'12345'
Attempts:
3 left
💡 Hint
Common Mistakes
Not quoting the ETag value.
Using single quotes instead of double quotes.
3fill in blank
hard

Fix the error in setting Cache-Control to allow caching for 10 minutes.

Rest API
response.headers['Cache-Control'] = '[1]'
Drag options to blanks, or click blank then click option'
Amax-age=600
Bmax_age=600
Cmaxage=600
Dmax-age:600
Attempts:
3 left
💡 Hint
Common Mistakes
Using underscore instead of dash.
Using colon instead of equals sign.
4fill in blank
hard

Fill both blanks to set Cache-Control to private and ETag to "abc123".

Rest API
response.headers['Cache-Control'] = '[1]'
response.headers['ETag'] = '[2]'
Drag options to blanks, or click blank then click option'
Aprivate
B"abc123"
Cpublic
Dabc123
Attempts:
3 left
💡 Hint
Common Mistakes
Setting ETag without quotes.
Using 'public' instead of 'private' for Cache-Control.
5fill in blank
hard

Fill all three blanks to set Cache-Control to no-store, ETag to "xyz789", and add a custom header X-Custom.

Rest API
response.headers['Cache-Control'] = '[1]'
response.headers['ETag'] = '[2]'
response.headers['X-Custom'] = '[3]'
Drag options to blanks, or click blank then click option'
Ano-store
B"xyz789"
Ccustom-value
Dno-cache
Attempts:
3 left
💡 Hint
Common Mistakes
Using no-cache instead of no-store.
Not quoting the ETag value.
Leaving custom header value empty.