Bird
0
0

You want to compress only responses larger than 500 bytes using Flask-Compress. Which configuration setting should you use?

hard📝 Application Q8 of 15
Flask - Middleware and Extensions
You want to compress only responses larger than 500 bytes using Flask-Compress. Which configuration setting should you use?
Aapp.config['COMPRESS_LEVEL'] = 500
Bapp.config['COMPRESS_THRESHOLD'] = 500
Capp.config['COMPRESS_MIN_SIZE'] = 500
Dapp.config['COMPRESS_MIN_BYTES'] = 500
Step-by-Step Solution
Solution:
  1. Step 1: Identify Flask-Compress config for minimum response size

    The setting COMPRESS_THRESHOLD controls the minimum response size in bytes to compress.
  2. Step 2: Match setting name with options

    app.config['COMPRESS_THRESHOLD'] = 500 correctly uses COMPRESS_THRESHOLD. Other options are invalid or do not exist.
  3. Final Answer:

    app.config['COMPRESS_THRESHOLD'] = 500 -> Option B
  4. Quick Check:

    Minimum size config = COMPRESS_THRESHOLD [OK]
Quick Trick: Use COMPRESS_THRESHOLD to set minimum compress size [OK]
Common Mistakes:
MISTAKES
  • Using wrong config names
  • Confusing compression level with size
  • Assuming min_size or min_bytes exist

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes