(config, request_dict, operation_model)
| 43 | |
| 44 | |
| 45 | def _should_compress_request(config, request_dict, operation_model): |
| 46 | if ( |
| 47 | config.disable_request_compression is not True |
| 48 | and config.signature_version != 'v2' |
| 49 | and operation_model.request_compression is not None |
| 50 | ): |
| 51 | if not _is_compressible_type(request_dict): |
| 52 | body_type = type(request_dict['body']) |
| 53 | log_msg = 'Body type %s does not support compression.' |
| 54 | logger.debug(log_msg, body_type) |
| 55 | return False |
| 56 | |
| 57 | if operation_model.has_streaming_input: |
| 58 | streaming_input = operation_model.get_streaming_input() |
| 59 | streaming_metadata = streaming_input.metadata |
| 60 | return 'requiresLength' not in streaming_metadata |
| 61 | |
| 62 | body_size = _get_body_size(request_dict['body']) |
| 63 | min_size = config.request_min_compression_size_bytes |
| 64 | return min_size <= body_size |
| 65 | |
| 66 | return False |
| 67 | |
| 68 | |
| 69 | def _is_compressible_type(request_dict): |
no test coverage detected